Created
September 2, 2019 14:49
-
-
Save simbo1905/3096062c8b6a43c0a0aa88ac3f9a1ada to your computer and use it in GitHub Desktop.
write out a config file to a PVCs wihin an initContainer
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
#!/bin/bash | |
cat | oc create -f - <<EOF | |
--- | |
apiVersion: "v1" | |
kind: "PersistentVolumeClaim" | |
metadata: | |
name: "config-data-claim" | |
spec: | |
accessModes: | |
- "ReadWriteMany" | |
resources: | |
requests: | |
storage: "1Gi" | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: my-app | |
spec: | |
containers: | |
- name: realworld | |
image: docker.io/simonmassey/react-redux-realworld:v0.0.2 | |
env: | |
- name: API_ROOT | |
value: https://conduit.productionready.io/api | |
volumeMounts: | |
- mountPath: /data | |
name: config-data-claim | |
initContainers: | |
- name: config-data | |
image: busybox | |
command: ["sh", "-c", "echo {'address':'10.0.1.192:2379/db'} > /data/config"] | |
volumeMounts: | |
- mountPath: /data | |
name: config-data-claim | |
volumes: | |
- name: config-data-claim | |
persistentVolumeClaim: | |
claimName: config-data-claim | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment