-
-
Save djschny/a220dc4b828efaa05e6cccfff6130579 to your computer and use it in GitHub Desktop.
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
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: nginx | |
labels: | |
app: nginx | |
spec: | |
selector: | |
app: nginx | |
type: LoadBalancer | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 80 | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: nginx | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
volumes: | |
- name: www | |
emptyDir: {} | |
containers: | |
- name: nginx | |
image: nginx:1.13.0 | |
ports: | |
- containerPort: 80 | |
volumeMounts: | |
- name: www | |
mountPath: /usr/share/nginx/html | |
livenessProbe: | |
successThreshold: 1 | |
periodSeconds: 1 | |
httpGet: | |
path: /alive | |
port: 80 | |
readinessProbe: | |
successThreshold: 1 | |
periodSeconds: 1 | |
httpGet: | |
path: /ready | |
port: 80 | |
# alternate every minute the pod being "ready" by removing a file that would be used by a readiness probe | |
- name: flapper | |
image: busybox | |
command: ["sh", "-c", "while true; do var=$((1-var)); if [ $var -eq 0 ];then echo OK > /usr/share/nginx/html/ready; else rm /usr/share/nginx/html/ready;fi; sleep 30; done"] | |
volumeMounts: | |
- name: www | |
mountPath: /usr/share/nginx/html | |
initContainers: | |
- name: slowness | |
image: busybox | |
command: ['sh', '-c', 'echo "Sleeping 10 seconds..." && sleep 20 && echo OK > /usr/share/nginx/html/alive'] | |
volumeMounts: | |
- name: www | |
mountPath: /usr/share/nginx/html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment