Today, we learned: 1. Define multiple containers in a pod 2. Set limits to avoid one service messing up the others 3. Use volumes so the contents of a container are kept between restarts
53 lines
1007 B
YAML
53 lines
1007 B
YAML
---
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
labels:
|
|
run: podsmania
|
|
service: webserver
|
|
name: podsmania
|
|
spec:
|
|
containers:
|
|
- image: nginx
|
|
name: nginx
|
|
resources:
|
|
limits:
|
|
cpu: '0.5'
|
|
memory: '128Mi'
|
|
requests:
|
|
cpu: '0.3'
|
|
memory: '96Mi'
|
|
volumeMounts:
|
|
- mountPath: /opt/nginx
|
|
name: custom-nginx-opt
|
|
- image: ealen/echo-server
|
|
name: echo
|
|
resources:
|
|
limits:
|
|
cpu: '0.5'
|
|
memory: '128Mi'
|
|
requests:
|
|
cpu: '0.25'
|
|
memory: '96Mi'
|
|
env:
|
|
- name: PORT
|
|
value: '3000'
|
|
- image: ubuntu
|
|
name: shell
|
|
args:
|
|
- sleep
|
|
- infinity
|
|
resources:
|
|
limits:
|
|
cpu: '0.25'
|
|
memory: '96Mi'
|
|
requests:
|
|
cpu: '0.1'
|
|
memory: '32Mi'
|
|
dnsPolicy: ClusterFirst
|
|
restartPolicy: Always
|
|
volumes:
|
|
- name: custom-nginx-opt
|
|
emptyDir:
|
|
sizeLimit: '256Mi'
|