Skip to content

Instantly share code, notes, and snippets.

@bbachi
Created August 30, 2020 17:34
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/76037006cbbe6c45ce468c4f4e7cbca6 to your computer and use it in GitHub Desktop.
Save bbachi/76037006cbbe6c45ce468c4f4e7cbca6 to your computer and use it in GitHub Desktop.
nginx pod
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: nginx-webapp
name: nginx-webapp
spec:
replicas: 5
selector:
matchLabels:
app: nginx-webapp
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: nginx-webapp
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: busybox1
image: busybox
command: ["/bin/sh"]
args: ["-c", "echo '<html><h1>Hi I am from Init container</h1>' >> /work-dir/index.html"]
volumeMounts:
- name: workdir
mountPath: "/work-dir"
- name: busybox2
image: busybox
command: ["/bin/sh"]
args: ["-c", "echo '<p>Hi I am from second Init container</p></html>' >> /work-dir/index.html"]
volumeMounts:
- name: workdir
mountPath: "/work-dir"
dnsPolicy: Default
volumes:
- name: workdir
emptyDir: {}
status: {}
---
apiVersion: v1
kind: Service
metadata:
name: nginx-webapp
labels:
run: nginx-webapp
spec:
ports:
- port: 80
protocol: TCP
selector:
app: nginx-webapp
type: NodePort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment