apiVersion: apps/v1 kind: Deployment metadata: name: web-php spec: replicas: 1 selector: matchLabels: run: web-php template: metadata: labels: run: web-php spec: containers: - image: maho/web-php:0.2 name: web-php resources: requests: cpu: 200m --- apiVersion: v1 kind: Service metadata: name: web-php spec: type: NodePort selector: run: web-php ports: - port: 80 protocol: TCP nodePort: 31446
$ kubectl autoscale deployment web-php --cpu-percent=50 --min=1 --max=10 horizontalpodautoscaler.autoscaling/web-php autoscaled
커맨드 | 동작 |
---|---|
kubectl describe node [노드명] | 노드의 자세한 내용을 출력. 리소스 보유량이나 사용량 등 HPA 사용을 계획할 때 필요한 정보 확인 가능 |
kubectl autoscale [컨트롤러] [오브젝트명] | HPA 설정. kubectl autoscale help 를 통해 사용법 확인 가능 |
kubectl get hpa | HPA 상태 출력. get 을 describe로 바꾸면 상세 내용 출력 |