kubectl get deploy
kubectl describe deploy http-go
kubectl get deploy http-go -o yaml
kubectl create -f http-go-deployment.yaml --record=true
--record=true
는 히스토리 저장
성공적으로 배포되었는지 확인
kubectl rollout status deploy http-go
kubectl rollout history deploy http-go deployment.apps/http-go
kubectl patch deploy http-go -p '{"spec":{"minReadySeconds":10}}'
kubectl get svc
kubectl expose deploy http-go service/http-go exposed
kubectl run -it --rm --image busybox -- bash
"kubectl run -it --rm --image busybox -- bash" 명령어는 Kubernetes 클러스터에서 BusyBox 이미지를 사용하여 인터랙티브한 컨테이너를 실행하는 명령어
"run": 새로운 Pod을 생성하고 실행하는 명령어
"-it": 컨테이너와 터미널 간의 인터랙티브한 세션을 생성
"--rm": 실행이 완료된 후에 컨테이너를 자동으로 제거
"--image busybox": 실행할 컨테이너에 사용할 이미지를 지정합니다. 여기서는 BusyBox 이미지를 사용
"-- bash": 컨테이너 내에서 바로 bash 셸을 실행하도록 지정
imkunyoung@master-1:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
bash 1/1 Running 0 2m22s
http-go-5569c6b9d7-sfqxb 1/1 Running 0 13m
http-go-5569c6b9d7-tmfj6 1/1 Running 0 13m
http-go-5569c6b9d7-twj9k 1/1 Running 0 13m
wget -O- -q 10.111.99.186:8080
while true; do wget -O- -q 10.111.99.186:8080; sleep 1; done
실행 중인 Deployment인 "http-go"의 컨테이너 이미지를 업데이트
kubectl set image deploy http-go http-go=gasbugs/http-go:v2
kubectl get pods -w
imkunyoung@master-1:~$ kubectl get pods -w
NAME READY STATUS RESTARTS AGE
bash 1/1 Running 0 5m49s
http-go-5569c6b9d7-sfqxb 1/1 Running 0 16m
http-go-5569c6b9d7-tmfj6 1/1 Running 0 16m
http-go-5569c6b9d7-twj9k 1/1 Running 0 16m
http-go-754564c56-bj8hb 1/1 Running 0 11s
http-go-754564c56-jwnws 0/1 Pending 0 0s
http-go-754564c56-jwnws 0/1 Pending 0 0s
http-go-5569c6b9d7-sfqxb 1/1 Terminating 0 16m
http-go-754564c56-jwnws 0/1 ContainerCreating 0 0s
http-go-5569c6b9d7-sfqxb 0/1 Terminating 0 16m
http-go-5569c6b9d7-sfqxb 0/1 Terminating 0 16m
http-go-5569c6b9d7-sfqxb 0/1 Terminating 0 16m
http-go-5569c6b9d7-sfqxb 0/1 Terminating 0 16m
http-go-754564c56-jwnws 1/1 Running 0 3s
http-go-5569c6b9d7-tmfj6 1/1 Terminating 0 17m
http-go-754564c56-5t4r4 0/1 Pending 0 0s
http-go-754564c56-5t4r4 0/1 Pending 0 0s
http-go-754564c56-5t4r4 0/1 ContainerCreating 0 0s
http-go-5569c6b9d7-tmfj6 0/1 Terminating 0 17m
http-go-5569c6b9d7-tmfj6 0/1 Terminating 0 17m
http-go-5569c6b9d7-tmfj6 0/1 Terminating 0 17m
http-go-5569c6b9d7-tmfj6 0/1 Terminating 0 17m
http-go-754564c56-5t4r4 1/1 Running 0 2s
http-go-5569c6b9d7-twj9k 1/1 Terminating 0 17m
http-go-5569c6b9d7-twj9k 0/1 Terminating 0 17m
http-go-5569c6b9d7-twj9k 0/1 Terminating 0 17m
http-go-5569c6b9d7-twj9k 0/1 Terminating 0 17m
http-go-5569c6b9d7-twj9k 0/1 Terminating 0 17m
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v2
Welcome! v1
Welcome! v1
Welcome! v2
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v2
Welcome! v1
Welcome! v1
Welcome! v1
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v1
Welcome! v2
Welcome! v1
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
Welcome! v2
kubectl rollout history deploy http-go
kubectl set image deploy http-go http-go=gasbugs/http-go:v2 --record=true
kubectl get rs
kubectl edit deploy http-go --record=true
undo
kubectl rollout undo deploy http-go
kubectl rollout history deploy http-go
특정 revision으로 undo
kubectl rollout undo deploy http-go --to-revision=1
kubectl rollout history deploy
http-go-deploy-v1.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: http-go
labels:
app: http-go
spec:
replicas: 3
selector:
matchLabels:
app: http-go
template:
metadata:
labels:
app: http-go
spec:
containers:
- name: http-go
image: gasbugs/http-go:v1
ports:
- containerPort: 8080