728x90
반응형
- Deployment -> ReplicaSet -> Pod
ㅁ실습
> 1. RollingUpdate 하기
// 1) HPA minReplica 2로 바꾸기 (이전 강의에서 minReplicas를 1로 바꿔놨었음)
kubectl patch -n anotherclass-123 hpa api-tester-1231-default -p '{"spec":{"minReplicas":2}}'
// 1) 그외 Deployment scale 명령
kubectl scale -n anotherclass-123 deployment api-tester-1231 --replicas=2
// 1) edit로 모드로 직접 수정
kubectl edit -n anotherclass-123 deployment api-tester-1231
// 2) 지속적으로 Version호출 하기 (업데이트 동안 리턴값 관찰)
while true; do curl http://192.168.56.30:31231/version; sleep 2; echo ''; done;
// 3) 별도의 원격 콘솔창을 열어서 업데이트 실행
kubectl set image -n anotherclass-123 deployment/api-tester-1231 api-tester-1231=1pro/api-tester:v2.0.0
kubectl set image -n anotherclass-123 deployment/api-tester-1231
// update 실행 포맷
// kubectl set image -n <namespace> deployment/<deployment-name> <container-name>=<image-name>:<tag>
> 2. RollingUpdate (maxUnavailable: 0%, maxSurge: 100%)
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: anotherclass-123
name: api-tester-1231
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25% -> 0% # 수정
maxSurge: 25% -> 100% # 수정
kubectl set image -n anotherclass-123 deployment/api-tester-1231 api-tester-1231=1pro/api-tester:v1.0.0
- maxUnavailable : 사용 불가능한 pod 최대 수
- maxSurge : 기존 deployment 정의된 pod 대비 최대 pod 증가 수
> 3. Recreate
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: anotherclass-123
name: api-tester-1231
spec:
replicas: 2
strategy:
type: RollingUpdate -> Recreate # 수정
rollingUpdate: # 삭제
maxUnavailable: 0% # 삭제
maxSurge: 100% # 삭제
kubectl set image -n anotherclass-123 deployment/api-tester-1231 api-tester-1231=1pro/api-tester:v2.0.0
> 4. Rollback
// 이전 버전으로 롤백
kubectl rollout undo -n anotherclass-123 deployment/api-tester-1231
> 참고 URL:
728x90
반응형
'Container > Kubernetes' 카테고리의 다른 글
[Kubernetes] Application 기능으로 이해하기 - HPA (1) | 2024.06.05 |
---|---|
[Kubernetes] Application 기능으로 이해하기 - Service (0) | 2024.06.05 |
[Kubernetes] Application 기능으로 이해하기 - PV/PVC (0) | 2024.06.05 |
[Kubernetes] Application 기능으로 이해하기 - Configmap, Secret (0) | 2024.05.29 |
[Kubernetes] Application 기능으로 이해하기 - Probe (0) | 2024.05.28 |