Skip to content

Instantly share code, notes, and snippets.

@mikesparr
Last active April 29, 2020 22:49
Show Gist options
  • Save mikesparr/e64b3677af21273da83ca1e6c55bfbd5 to your computer and use it in GitHub Desktop.
Save mikesparr/e64b3677af21273da83ca1e6c55bfbd5 to your computer and use it in GitHub Desktop.
Article content for InitContainers
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: test-app
name: test-app
spec:
replicas: 1
selector:
matchLabels:
app: test-app
template:
metadata:
labels:
app: test-app
spec:
volumes:
- name: test-volume
persistentVolumeClaim:
claimName: test-pvc
containers:
- name: myapp-container
image: busybox:1.28
command: ['sh', '-c', "cat /tmp/hello.txt | xargs -I % echo File content: % && sleep 3600"]
volumeMounts:
- name: test-volume
mountPath: /tmp
initContainers:
- name: init-myservice
image: busybox:1.28
command: ['sh', '-c', "echo 'Hello, World!' > /tmp/hello.txt"]
volumeMounts:
- name: test-volume
mountPath: /tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment