Application Lifecycle Management
2) Commands and Arguments
1. How many PODs exist on the system?
in the current(default) namespace
controlplane ~ ➜ kubectl get pod
NAME READY STATUS RESTARTS AGE
ubuntu-sleeper 1/1 Running 0 2m27s
02. What is the command used to run the pod ubuntu-sleeper?
ask : sleep 4800
controlplane ~ ➜ kubectl get pod ubuntu-sleeper -o yaml > ub.yaml
controlplane ~ ➜ cat ub.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2022-01-20T08:27:58Z"
name: ubuntu-sleeper
namespace: default
resourceVersion: "752"
uid: 5ebef2e1-9e57-4ff8-b9c4-88ae0812b4bd
spec:
containers:
- command:
- sleep
- "4800"
image: ubuntu
imagePullPolicy: Always
name: ubuntu
...
03. Create a pod with the ubuntu image to run a container to sleep for 5000 seconds.
Modify the file ubuntu-sleeper-2.yaml
Note: Only make the necessary changes. Do not modify the name.
- Pod Name: ubuntu-sleeper-2
- Command: sleep 5000
command 추가 가능 >> ['sleep', '5000'] 이런 방법도 있음.
04. Create a pod using the file named ubuntu-sleeper-3.yaml.
There is something wrong with it. Try to fix it!
Note: Only make the necessary changes. Do not modify the name.
- Pod Name: ubuntu-sleeper-3
- Command: sleep 1200
# as-is
- "sleep"
- 12000
# to-be
- sleep
- "12000"
05.
kubectl apply -f ubuntu-sleeper-3.yaml --force
06. Inspect the file Dockerfile given at /root/webapp-color. What command is run at container startup?
1) python app.py (정답)
2) nginx
3) mysqld
4) Flask run
5) sleep 4800
# Inspect the ENTRYPOINT in the Dockerfile
FROM python:3.6-alpine
RUN pip install flask
COPY . /opt/
EXPOSE 8080
WORKDIR /opt
ENTRYPOINT ["python", "app.py"]
~
~
07. Inspect the file Dockerfile2 given at /root/webapp-color. What command is run at container startup?
1) python app.py --color blue
2) python app.py --color red (정답)
3) python app.py
FROM python:3.6-alpine
RUN pip install flask
COPY . /opt/
EXPOSE 8080
WORKDIR /opt
ENTRYPOINT ["python", "app.py"]
CMD ["--color", "red"]
08. Inspect the two files under directory webapp-color-2. What command is run at container startup?
Assume the image was created from the Dockerfile in this folder
ask : python app.py --color red
# Dockerfile2
FROM python:3.6-alpine
RUN pip install flask
COPY . /opt/
EXPOSE 8080
WORKDIR /opt
ENTRYPOINT ["python", "app.py"]
CMD ["--color", "red"]
# webapp-color-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: webapp-green
labels:
name: webapp-green
spec:
containers:
- name: simple-webapp
image: kodekloud/webapp-color
command: ["--color","green"]
09. Inspect the two files under directory webapp-color-3. What command is run at container startup?
Assume the image was created from the Dockerfile in this folder
ask : python app.py --color pink
# webapp-color-pod-2.yaml
apiVersion: v1
kind: Pod
metadata:
name: webapp-green
labels:
name: webapp-green
spec:
containers:
- name: simple-webapp
image: kodekloud/webapp-color
command: ["python", "app.py"]
args: ["--color", "pink"]
10. 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
- Pod Name: webapp-green
- Image: kodekloud/webapp-color
- Command line arguments: --color=green
---
apiVersion: v1
kind: Pod
metadata:
name: webapp-green
labels:
name: webapp-green
spec:
containers:
- name: simple-webapp
image: kodekloud/webapp-color
args: ["--color", "green"]
'CKA (Certified Kubernetes Administrator) > Kode Kloud' 카테고리의 다른 글
4.Application Lifecycle Management - Secrets (0) | 2022.01.21 |
---|---|
4.Application Lifecycle Management - Env Variables (0) | 2022.01.21 |
4.Application Lifecycle Management - Rolling Updates and Rollbacks (0) | 2022.01.20 |
03.Logging & Monitoring - Managing Application Logs (0) | 2022.01.20 |
03.Logging & Monitoring - Monitor Cluster Components (0) | 2022.01.20 |