Skip to content

Commit

Permalink
Add a sidecar example
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunyiLyu committed Jul 12, 2021
1 parent dba42f2 commit e7602a9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/examples/sidecar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Sidecar Example

This example adds an additional container in the rabbitmq pod using the StatefulSet override. You can add multiple additional containers and add additional containers to `initContainers` as well.

You can deploy this example:

```shell
kubectl apply -f rabbitmq.yaml
```
15 changes: 15 additions & 0 deletions docs/examples/sidecar/rabbitmq.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: sidecar
spec:
replicas: 1
override:
statefulSet:
spec:
template:
spec:
containers:
- name: additional-container
image: busybox
command: ['sh', '-c', 'echo "Hello, Kubernetes!" && sleep 5000']
5 changes: 5 additions & 0 deletions docs/examples/sidecar/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

kubectl get pod sidecar-server-0 -o jsonpath="{.spec.containers[*].image}" | grep busybox
kubectl get pod sidecar-server-0 | grep 2/2

0 comments on commit e7602a9

Please sign in to comment.