02-05-02 Kubernetes Deployment and Service

Docker/Kubernetes workshop

02-05-02 Kubernetes Deployment and Service

Create a deployment

Before starting, take a look at the YAML definition of the deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dockercoins
spec:
  selector:
    matchLabels:
      app: dockercoins
  template:
    metadata:
      labels:
        app: dockercoins
    spec:
      containers:
      - name: rng
        image: rotcaus/dockercoins_rng:v1
        imagePullPolicy: Always
      - name: hasher
        image: rotcaus/dockercoins_hasher:v1
        imagePullPolicy: Always
      - name: webui
        image: rotcaus/dockercoins_webui:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 80
      - name: worker
        image: rotcaus/dockercoins_worker:v1
        imagePullPolicy: Always
      - name: redis
        image: redis

There are a few noteworthy parts here:

Apply this deployment with the kubectl apply command:

kubectl apply -f deployment.yml

Now that the deployment is created, start looking at the events happening in the cluster:

kubectl get events --watch

Look for a new pod by running kubectl get pod. Once you have found it,