Difficulty: intermediate
Estimated Time: 20-30 minutes

BoxBoat Logo

Welcome to day 3 of Kubernetes Fundamentals! We spent a lot of time yesterday going over the core objects in Kubernetes, and there are a lot of them. Configuring these objects is relatively easy, but can be extremely verbose, and there are a lot of extra pieces of configuration to consider.

Before we dive into new concepts for day 3, let's go over what we did yesterday.

Please email feedback to: [email protected]

Now that we've refreshed everything from the previous day, let's dive into ConfigMaps.

KF2 Review

Step 1 of 3

Deployments

Deployments are the main way that we configure our applications. When we create a Deployment, we are really creating:

  1. A set of metadata, including labels
  2. A ReplicaSet
  3. 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:

  1. If we were to deploy this in our current environment, what would happen?

  2. Next, we would eventually check this into Git. Who sees a problem with that?

  3. 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?

  4. 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?

  5. 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?