Chapter 7: Updating and Scaling an Application in Kubernetes
Activity 8: Enabling Autoscaling and Performing a Rolling Update
Solution:
Perform the following steps to complete this activity:
- Create a deployment definition file that uses the
suakbas/lesson07:v1
image and has the RollingUpdate strategy type set; this application does a CPU-intensive operation:apiVersion: apps/v1 kind: Deployment metadata: name: lesson07-deployment spec: replicas: 1 strategy: type: RollingUpdate selector: matchLabels: app: lesson07 template: metadata: labels: app: lesson07 spec: containers: - image: suakbas/lesson07:v1 imagePullPolicy: Always name: lesson07 resources: requests: memory: "500m" cpu: "250m"
- Deploy the deployment and check whether the pod is running:
$ kubectl apply -f deployment.yaml -n lesson-7
$ kubectl get pods -n lesson-7
Figure 7.21...