본문 바로가기

CKA &. CKAD/Application Lifecycle Management

Practice Test - Multi-Container Pod

 

[Practice Test]

 

ㅁ Identify the number of containers running in the 'red' pod

kubectl get pod red

 

ㅁ Identify the name of the containers running in the 'blue' pod

kubectl describe pod blue

 

ㅁ Create a multi-container pod with 2 containers

- Name: yellow

- Container 1 Name: lemon

- Container 1 Image: busybox

- Container 2 Name: gold

- Container 2 Image: redis

kubectl run yellow --image=busybox --restart=Never --dry-run=client -o yaml > yellow.yaml

yellow-definition.yaml

apiVersion: v1
kind: Pod
metadata:
  name: yellow
spec:
  containers:
  - image: busybox
    name: lemon
  - image: redis
    name: gold
kubectl create -f yellow-definition.yaml

 

ㅁ we have deployed an application loggin stack in the elastic-stack namespace. Inspect it.

ㅁ Inspect the Kibana UI using the link above your terminal. There shouldn't be any logs for now.

ㅁ Inspect the 'app' pod and identify the number of containers in it. (it is deployed in the elastic-stack namespace)

kubectl get pod app --namespace=elstic-stack

 

ㅁ The 'app' lication outputs logs to the file /log/app.log. View the logs and try to identify the user having issues with Login.

kubectl -n elastic-stack logs app

or

kubectl -n elastic-stack exec -it app cat /log/app.log

 

ㅁ Edit the pod to add a sidecar container to send logs to ElasticSearch. Mount the log volume to the sidecar container.

(only add a new container. Do not modify anything else. Use the spec on the right.

- Name: app

- Container Name: sidecar

- Cotainer Image: kodekloud/filebeat-configured

- Volume Mount: log-volume

- Mount Path: /var/log/event-simulator/

- Existing Container Name: app

- Existing Container I?mage: kodekloud/event-simulator

 

kubectl edit pod app -n elastic-stack

 

아래 내용 수정 후 생긴 임시 파일로 app pod 다시 생성

apiVersion: v1
kind: Pod
metadata:
  name: app
  namespace: elastic-stack
  labels:
    name: app
spec:
  containers:
  - name: app
    image: kodekloud/event-simulator
    imagePullPolicy: Always
    volumeMounts:
    - mountPath: /log
      name: log-volume
  - name: sidecar
    image: kodekloud/filebeat-configured
    volumeMounts:
    - mountPath: /var/log/event-simulator/
      name: log-volume
  volumes:
  - hostPath:
      path: /var/log/webapp
      type: DirectoryOrCreate
    name: log-volume
 

https://bit.ly/2EXYdHf

 

Kubernetes CKAD - Kibana Dashboard

Check out a video I made via Loom

www.loom.com

 

'CKA &. CKAD > Application Lifecycle Management' 카테고리의 다른 글

InitContainer and Practice Test  (0) 2021.03.28
Secret Practice Test  (0) 2021.03.27
Secret  (0) 2021.03.27
ConfigMap Practice Test  (0) 2021.03.27
Configure Environment Variable in Applications  (0) 2021.03.27