Kubernetes
go-zero 서비스 실행 well 에서 Kubernetes 사용하여 minimal 설정.
apiVersion: apps/v1kind: Deploymentmetadata: name: order-apispec: replicas: 3 selector: matchLabels: {app: order-api} template: metadata: labels: {app: order-api} spec: containers: - name: order-api image: myregistry/order-api:latest ports: - containerPort: 8888 resources: requests: {cpu: 100m, memory: 128Mi} limits: {cpu: 500m, memory: 256Mi} livenessProbe: httpGet: {path: /healthz, port: 8888} initialDelaySeconds: 10 readinessProbe: httpGet: {path: /healthz, port: 8888} initialDelaySeconds: 5Service
섹션 제목: “Service”apiVersion: v1kind: Servicemetadata: name: order-api-svcspec: selector: {app: order-api} ports: [{port: 8888, targetPort: 8888}]ConfigMap
섹션 제목: “ConfigMap”apiVersion: v1kind: ConfigMapmetadata: name: order-api-configdata: app.yaml: | Name: order-api Host: 0.0.0.0 Port: 8888HPA
섹션 제목: “HPA”apiVersion: autoscaling/v2kind: HorizontalPodAutoscalermetadata: name: order-api-hpaspec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: order-api minReplicas: 2 maxReplicas: 20 metrics: - type: Resource resource: name: cpu target: {type: Utilization, averageUtilization: 60}Apply
섹션 제목: “Apply”kubectl apply -f k8s/kubectl rollout status deployment/order-api