카테고리 없음

CKA questions part-2

BenzhaminKim 2021. 11. 20. 21:38

Question 1. Create a new deployment called web-003. Scale the deployment to 3 replicas. Make sure desired number of pod always running.

kubectl create deployment web-003 --image=nginx --dry-run=client -o yaml


```
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: web-003
  name: web-003
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web-003
  strategy: {}
  template:
    metadata:
      labels:
        app: web-003
    spec:
      containers:
      - image: nginx
        name: nginx
        resources: {}
status: {}
```

Yon can check kubernetes controller manager file in /etc/kubernetes/manifasts/kube-controller-manager.yaml

 

 

Question 2. Upgrade the Cluster (Master and worker Node) from 1.18.0 to 1.19.0. Make sure to first drain Node and make it available after upgrade.

#drain and update Master Node

kubectl drain mastrerNode -ignore-daemonsets

apt update

apt install kubeadm=1.19.0-00

kubctl upgrade apply v1.19.0

apt install kubelet=1.19.0-00

sytemctl restart kubelet

kubctl uncordon masterNode

---

# drain and update Worker Node

kubectl drain node01 --ignore-daemonsets

apt update

apt install kubeadm=1.19.0-00

kubctl upgrade apply v1.19.0

apt install kubelet=1.19.0-00

sytemctl restart kubelet

kubctl uncordon workerNode

Question 3. Deploy a web-load-5461 pod using the nginx:1.17 image with the labels set to tier=web.

 

kubectl run web-load-5461 --image=nginx:1.17 --labels tier=web

kubectl get pod web-load-5461 --show-labels