1. Rolling Update, Recreate
[ 1 ] deployment .yaml 파일을 바꿀 때 set과 edit을 사용할 수 있다.
2. Commands
[ 1 ] Create a pod with the given specifications. By default it displays a blue background. Set the given command line arguments to change it to green.
> kubectl run webapp-green --image=kodekloud/webapp-color --dry-run=client -o yaml
> kubectl run webapp-green --image kodekloud/webapp-color -- --color green
* (1) --dry-run=client -o yaml 옵션을 사용하여 실제로 Pod를 생성하지 않고, 생성될 Pod에 대한 YAML 표현을 출력합니다. 이는 Pod를 생성하기 전에 YAML 파일을 미리 확인하고자 할 때 유용. (2) --로 구분하여 이미지 이름과 kubectl에 대한 옵션을 구분합니다. 여기서는 "--color green" 옵션을 사용하여 컨테이너 내부에서 애플리케이션에게 "green"이라는 색을 전달
3. Environment Variables
[ 1 ] Update the environment variable on the POD to display a green background. Note: Delete and recreate the POD. Only make the necessary changes. Do not modify the name of the Pod.
> k edit pod webapp-color
error: pods "webapp-color" is invalid
A copy of your changes has been stored to "/tmp/kubectl-edit-3394737197.yaml"
error: Edit cancelled, no valid changes were saved.
> vi /tmp/kubectl-edit-3394737197.yaml
> k replace --force -f /tmp/kubectl-edit-3394737197.yaml
[ 2 ] Create a new ConfigMap for the webapp-color POD. Use the spec given below.
> kubectl create configmap webapp-config-map --from-literal=APP_COLOR=darkblue --from-literal=APP_OTHER=disregard
4. Secrets
[ 1 ] The reason the application is failed is because we have not created the secrets yet. Create a new secret named db-secret with the data given below. You may follow any one of the methods discussed in lecture to create the secret.
> kubectl create secret generic db-secret --from-literal=DB_Host=sql01 --from-literal DB_User=root --from-literal DB_Password=password123
5. Multiple Container Pods
[ 1 ] Create a multi-container pod with 2 containers. Use the spec given below: If the pod goes into the crashloopbackoff then add the command sleep 1000 in the lemon container.
> k run yellow --image=busybox --dry-run=client -o yaml > yellow.yaml
> vi yellow.yaml
> k create -f yellow.yaml
*로그 확인 > k logs app -n elastic-stack
6. InitContainers
[ 1 ] A new application orange is deployed. There is something wrong with it. Identify and fix the issue. Once fixed, wait for the application to run before checking solution.
> k logs orange -c init-myservice
'Kubernetes 학습 > Udemy CKA with Practice Tests' 카테고리의 다른 글
KodeKloud - Test Record (section 6) (0) | 2024.07.02 |
---|---|
Section 6 : Cluster Maintenance (0) | 2024.07.02 |
Section 5 : Application Lifecycle Management (0) | 2024.03.10 |
KodeKloud - Test Record (section 3 & 4) (0) | 2024.02.22 |
Section 4 : Scheduling & Logging, Monitoring (0) | 2024.02.22 |