Created
May 9, 2019 00:24
-
-
Save 27Bslash6/7021fb618862b427d0a9c7c6f68dfa65 to your computer and use it in GitHub Desktop.
Mounting a Kubernetes secret file into an existing directory
This file contains hidden or 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
[thing] | |
stuff=flibbleAndPtang | |
foo=bar!@$@ |
This file contains hidden or 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: Pod | |
metadata: | |
name: secret-test-pod | |
spec: | |
containers: | |
- name: test-container | |
image: nginx | |
volumeMounts: | |
- name: secret-volume | |
mountPath: /etc/config.toml | |
subPath: config.toml | |
volumes: | |
- name: secret-volume | |
secret: | |
secretName: secret-test |
This file contains hidden or 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: secret-test | |
data: | |
config.toml: W3RoaW5nXQpzdHVmZj1mbGliYmxlQW5kUHRhbmcKZm9vPWJhciFAJEAK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note the contents of the secret
data.config.toml
must be base64 encoded, eg viaopenssl enc -base64 < config.toml
kubectl apply -f secret-test.yaml kubectl apply -f secret-test-pod.yaml kubectl exec secret-test-pod cat /etc/config.toml