Created
August 24, 2017 20:29
-
-
Save chrisfjones/a14e3ffa26c099c35b298624559646f4 to your computer and use it in GitHub Desktop.
kubernetes - test dynamic secrets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: mysecret | |
type: Opaque | |
data: | |
hello: d29ybGQ= | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: mypod | |
spec: | |
containers: | |
- name: bash | |
image: busybox | |
args: | |
- "sleep" | |
- "300" | |
volumeMounts: | |
- name: secretvolume | |
mountPath: "/etc/secrets" | |
volumes: | |
- name: secretvolume | |
secret: | |
secretName: mysecret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
kubectl apply -f secret-test.yml | |
echo "wait for pod to download/run" | |
sleep 5 | |
kubectl exec mypod -- cat /etc/secrets/hello | |
kubectl patch secret mysecret -p '{"data":{"hello":"bW9t"}}' | |
echo "eventually consistent" | |
sleep 1 | |
for i in {1..15} | |
do | |
sleep 2 | |
kubectl exec mypod -- cat /etc/secrets/hello | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment