K8s Deployments
MD
R
MarkdownK8s Deployments are all about rolling updates and rollbacks. Please ensure a SERVICE is deployed in order to map the container ports to the outside world. kubectl cheatsheet: https://www.coderecipes.org/recipes/5a09b73cfd82c96824de74fc Docs: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
Highest Level of Abstraction Deployment (manage) > RC (manage) > Pod
Create a YML Deployment file
touch deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: sampleapp-deployment
labels:
app: sampleapp
spec:
replicas: 7
minReadySeconds: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
selector:
matchLabels:
app: sampleapp
template:
metadata:
labels:
app: sampleapp
spec:
containers:
- name: myapp-container
image: nginx:1.7.9
ports:
- containerPort: 80
Push the YML to apiserver{}
kubectld create -f deployment.yml
K8s will perform a rolling update
Create new RCs and Pods, but keeps the old ones for rollback *ensure all container images are tagged properly Tuning in readiness probs and time to ready should be done.
Created on 5/24/2018