2. kubectl 실습

2022. 3. 6. 18:15

kubectl 명령어 기본구조

kubectl [Command] [Type] [Name] [Flags]

 

 

  • nginx pod 1개 실행 > 1개 실행 시 run 명령어 사용가능
$ kubectl run webserver --image=nginx:1.14 --port 80

 

  • httpd pod 3개 실행 > 1개 이상 pod 생성 시 create 명령어 사용
$ kubectl create deployment mainui --image=httpd:latest --replicas=3
httpd 뒤에 : 을 생략하면 latest 버전을 당겨온다

$kubectl get deployments.apps 
배포된 app들을 확인

 

  • 현재 올라 와 있는 pod들 중 webserver 컨테이너에 들어가서 index.html 파일을 수정

$ kubectl exec webserver -it -- /bin/bash
webserver 를 실행

 

반응형

'K8S' 카테고리의 다른 글

TKG_1.3.1 + Kubeapps  (0) 2022.04.12
1. 쿠버네티스 환경 구성  (0) 2022.03.05
0. 쿠버네티스란  (0) 2022.03.05

BELATED ARTICLES

more