Skip to content

Instantly share code, notes, and snippets.

@bbachi
Created August 30, 2020 15:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bbachi/80ad10846af719045e5058e5d20613bd to your computer and use it in GitHub Desktop.
Save bbachi/80ad10846af719045e5058e5d20613bd to your computer and use it in GitHub Desktop.
nginx pod
apiVersion: v1
kind: Pod
metadata:
name: init-container-demo
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: workdir
mountPath: /usr/share/nginx/html
# These containers are run during pod initialization
initContainers:
- name: busybox
image: busybox
command: ["/bin/sh"]
args: ["-c", "echo '<html><h1>Hi I am from Init container</h1><html>' >> /work-dir/index.html"]
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment