diff --git a/README.md b/README.md index 1d0bb89..e28ddf2 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Specifications: Web API: * `GET /` prints runtime information, environment variables, labels and annotations +* `GET /version` prints podinfo version and git commit hash * `GET /metrics` http requests duration and Go runtime metrics * `GET /healthz` used by Kubernetes liveness probe * `GET /readyz` used by Kubernetes readiness probe @@ -48,9 +49,7 @@ helm init --skip-refresh --upgrade --service-account tiller Install podinfo in the default namespace exposed via a ClusterIP service: ```bash -helm upgrade --install --wait \ - --name prod \ - ./podinfo +helm upgrade --install --wait prod ./podinfo ``` Check if podinfo service is accessible from within the cluster: @@ -62,18 +61,27 @@ helm test --cleanup prod Install podinfo exposed via a NodePort service: ```bash -helm upgrade --install --wait \ - --name prod \ +helm upgrade --install --wait prod \ --set service.type=NodePort \ --set service.nodePort=31198 \ ./podinfo ``` +Set CPU/memory requests and limits: + +```bash +helm upgrade --install --wait prod \ + --set resources.requests.cpu=10m \ + --set resources.limits.cpu=100m \ + --set resources.requests.memory=16Mi \ + --set resources.limits.memory=128Mi \ + ./podinfo +``` + Install podinfo with horizontal pod autoscaling (HPA) based on CPU average usage and memory consumption: ```bash -helm upgrade --install --wait \ - --name prod \ +helm upgrade --install --wait prod \ --set hpa.enabled=true \ --set hpa.maxReplicas=10 \ --set hpa.cpu=80 \ @@ -81,7 +89,7 @@ helm upgrade --install --wait \ ./podinfo ``` -Deploy a new podinfo release: +Upgrade podinfo version: ```bash helm upgrade prod \ diff --git a/chart/stable/podinfo/templates/hpa.yaml b/chart/stable/podinfo/templates/hpa.yaml index a122304..35969a4 100644 --- a/chart/stable/podinfo/templates/hpa.yaml +++ b/chart/stable/podinfo/templates/hpa.yaml @@ -11,12 +11,16 @@ spec: minReplicas: {{ .Values.replicaCount }} maxReplicas: {{ .Values.hpa.maxReplicas }} metrics: + {{- if .Values.hpa.cpu }} - type: Resource resource: name: cpu targetAverageUtilization: {{ .Values.hpa.cpu }} + {{- end }} + {{- if .Values.hpa.memory }} - type: Resource resource: name: memory targetAverageValue: {{ .Values.hpa.memory }} + {{- end }} {{- end }} diff --git a/chart/stable/podinfo/values.yaml b/chart/stable/podinfo/values.yaml index f8a01c3..55b091e 100644 --- a/chart/stable/podinfo/values.yaml +++ b/chart/stable/podinfo/values.yaml @@ -13,11 +13,14 @@ service: containerPort: 9898 nodePort: 31198 +# Heapster or metrics-server add-on required hpa: enabled: false maxReplicas: 10 - cpu: 80 - memory: 200Mi + # average total CPU usage per pod (1-100) + cpu: + # average memory usage per pod (100Mi-1Gi) + memory: ingress: enabled: false @@ -34,8 +37,6 @@ ingress: resources: limits: - cpu: 100m - memory: 128Mi requests: cpu: 1m memory: 16Mi