DevOps

CKA 예제 리마인더 - 14. Commands and Arguments

Vince_rf 2024. 10. 31. 23:57

sleep 5000 명령을 수행하는 새로운 파드를 만드세요

apiVersion: v1 
kind: Pod 
metadata:
  name: ubuntu-sleeper-2 
spec:
  containers:
  - name: ubuntu
    image: ubuntu
    command:
    - sleep
    - "5000"


Solution)

apiVersion: v1 
kind: Pod 
metadata:
  name: ubuntu-sleeper-2 
spec:
  containers:
  - name: ubuntu
    image: ubuntu
    command:
    - sleep
    - "5000"
    
 or
 
 command:
 - "sleep"
 - "5000"
 
 or
 
 command: [ "sleep", "5000" ]
 
 or
 
 command: [ "sleep" ]
 args: [ "5000" ]




잘못된 Manifest를 수정하세요

apiVersion: v1
kind: Pod 
metadata:
  name: ubuntu-sleeper-3
spec:
  containers:
  - name: ubuntu
    image: ubuntu
    command:
      - "sleep"
      - 1200



spec.command 에서 1200를 쌍따옴표로 감싸줌

apiVersion: v1
kind: Pod 
metadata:
  name: ubuntu-sleeper-3
spec:
  containers:
  - name: ubuntu
    image: ubuntu
    command:
      - "sleep"
      - "1200"





command --color green 을 수행하는 파드를 만드세요

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", "green"]