Created
August 30, 2020 17:34
-
-
Save bbachi/76037006cbbe6c45ce468c4f4e7cbca6 to your computer and use it in GitHub Desktop.
nginx pod
This file contains 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: 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