Deployments are the main way that we configure our applications. When we create a Deployment, we are really creating:
- A set of metadata, including labels
- A ReplicaSet
- One or more Pods managed by the ReplicaSet
Our Deployment tracks the revision history of the ReplicaSet, which lets us roll-back if anything happens.
Here is an example Deployment Manifest:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 5 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:alpine ports: - containerPort: 80 env: - name: user value: admin - name: password value: root - name: host value: katacoda resources: limits: memory: "256Mi" cpu: "1"
Let's go through the following questions/tasks:
If we were to deploy this in our current environment, what would happen?
Next, we would eventually check this into Git. Who sees a problem with that?
I can probably build this file from scratch and only make a few mistakes, almost all YAML related. Who knows how we can do this more easily?
Okay, let's fix this Manifest so it will run on our system, and then deploy it. Who can walk me through step-by-step how to fix this, deploy it, and then track the events that are associated with each object?
Great, now our application is deployed. Except, our Ops team detected a critical vulnerability in
nginx:alpine, we need to downgrade to
nginx:1.14. Who can help me do this, then walk me through what happened?