Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Auto Scaling Kubernetes Clusters on OpenStack

Auto Scaling Kubernetes Clusters on OpenStack

One of the key features of Kubernetes is to make up and down scaling of your application workloads as easy as possible. In this talk you will learn how to setup and use the horizontal pod autoscaler to dynamically up and down scale pods in complex setups. We are also excited to show you how we built a node autoscaler for Kubernetes on OpenStack, which allows to add worker nodes to running clusters, before the horizontal pod autoscaler runs out of resources. We will also give you an overview of the current state of the vertical autoscaler in Kubernetes. When configured, it will set the resource requests for CPU and memory automatically based on usage and thus allow proper scheduling onto nodes so that the appropriate resource amount is available for each pod.

Bastian Hofmann

November 13, 2018
Tweet

More Decks by Bastian Hofmann

Other Decks in Programming

Transcript

  1. • A container runs a docker image. • Only 1

    process can run inside of a container Container
  2. • A group of 1 or more containers • Shared

    network • Shared storage volumes Pod
  3. kind: Deployment apiVersion: extensions/v1beta1 metadata: name: hello-world spec: template: spec:

    containers: - name: hello-world image: nginxdemos/hello:0.2 ports: - containerPort: 80
  4. kind: Deployment apiVersion: extensions/v1beta1 metadata: name: hello-world spec: replicas: 3

    template: spec: containers: - name: hello-world image: nginxdemos/hello:0.2 ports: - containerPort: 80
  5. kind: Deployment ... containers: - name: hello-world image: nginxdemos/hello:0.2 resources:

    requests: cpu: 100m memory: 256Mi limits: cpu: 100m memory: 256Mi ...
  6. kind: Deployment apiVersion: extensions/v1beta1 metadata: name: hello-world spec: replicas: 1

    template: spec: containers: - name: hello-world image: nginxdemos/hello:0.2 ports: - containerPort: 80
  7. $ kubectl get service hello-world NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)

    AGE hello-world-svc LoadBalancer 10.10.10.102 195.192.xxx.xxx 80:31750/TCP 37s
  8. $ kubectl get pods NAME READY STATUS RESTARTS AGE hello-world-fc5fd8f57-dmfjt

    1/1 Running 0 26h hello-world-fc5fd8f57-db42a 1/1 Running 0 26h hello-world-fc5fd8f57-u9htw 1/1 Running 0 26h hello-world-fc5fd8f57-btw4h 1/1 Running 0 26h hello-world-fc5fd8f57-t4qn5 1/1 Running 0 26h hello-world-fc5fd8f57-nw5yj 1/1 Running 0 26h hello-world-fc5fd8f57-ny53n 1/1 Running 0 26h hello-world-fc5fd8f57-klxw5 1/1 Running 0 26h hello-world-fc5fd8f57-k0t5s 1/1 Running 0 26h hello-world-fc5fd8f57-653na 1/1 Running 0 26h hello-world-fc5fd8f57-xfis4 1/1 Running 0 26h hello-world-fc5fd8f57-klds7 1/1 Running 0 26h hello-world-fc5fd8f57-babre 1/1 Running 0 26h hello-world-fc5fd8f57-aj5et 1/1 Running 0 26h hello-world-fc5fd8f57-q5aha 1/1 Running 0 26h hello-world-fc5fd8f57-au5a5 1/1 Running 0 26h
  9. kind: Deployment apiVersion: extensions/v1beta1 metadata: name: hello-world spec: replicas: 15

    template: spec: containers: - name: hello-world image: nginxdemos/hello:0.2 ports: - containerPort: 80
  10. $ kubectl get horizontalpodautoscaler hello-app NAME REFERENCE TARGETS MINPODS MAXPODS

    REPLICAS hello-app Deployment/hello-world <unknown>/5% 1 6 2
  11. $ kubectl describe horizontalpodautoscaler hello-world ... Events: Type Reason Age

    From Message ---- ------ ---- ---- ------- Normal SuccessfulRescale 15m (x222 over 71m) horizontal-pod-autoscaler New size: 6; reason: Current number of replicas above Spec.MaxReplicas
  12. kind: Deployment ... containers: - name: hello-world image: nginxdemos/hello:0.2 resources:

    requests: cpu: 100m memory: 256Mi limits: cpu: 100m memory: 256Mi ...
  13. $ kubectl get pods NAME READY STATUS RESTARTS AGE hello-world-fc5fd8f57-dmfjt

    0/1 Pending 0 26h hello-world-fc5fd8f57-db42a 0/1 Pending 0 26h hello-world-fc5fd8f57-u9htw 0/1 Pending 0 26h hello-world-fc5fd8f57-btw4h 0/1 Pending 0 26h hello-world-fc5fd8f57-t4qn5 1/1 Running 0 26h hello-world-fc5fd8f57-nw5yj 1/1 Running 0 26h hello-world-fc5fd8f57-ny53n 1/1 Running 0 26h hello-world-fc5fd8f57-klxw5 1/1 Running 0 26h hello-world-fc5fd8f57-k0t5s 1/1 Running 0 26h hello-world-fc5fd8f57-653na 1/1 Running 0 26h hello-world-fc5fd8f57-xfis4 1/1 Running 0 26h hello-world-fc5fd8f57-klds7 1/1 Running 0 26h hello-world-fc5fd8f57-babre 1/1 Running 0 26h hello-world-fc5fd8f57-aj5et 1/1 Running 0 26h hello-world-fc5fd8f57-q5aha 1/1 Running 0 26h hello-world-fc5fd8f57-au5a5 1/1 Running 0 26h
  14. $ kubectl descript pod hello-world-fc5fd8f57-dmfjt Events: Type Reason Age From

    Message ---- ------ ---- ---- ------- Warning FailedScheduling 2s (x5 over 10s) default- scheduler 0/3 nodes are available: 3 Insufficient cpu.
  15. kubectl get nodes NAME STATUS ROLES AGE VERSION kubermatic-fhgbvx65xg-7flj7 Ready

    <none> 7d1h v1.12.2 kubermatic-fhgbvx65xg-hmgd4 Ready <none> 7d2h v1.12.2 kubermatic-fhgbvx65xg-q287t Ready <none> 7d2h v1.12.2
  16. ... cloudProvider: openstack cloudProviderSpec: availabilityZone: dbl flavor: m1-small floatingIpPool: ext-net

    identityEndpoint: "https://cloud.sys11.net/v3" image: "Ubuntu 18.04" network: kubermatic-c123 region: dbl securityGroups: - kubermatic-c123 operatingSystem: ubuntu operatingSystemSpec:
  17. kubectl get machines -n kube-system NAME AGE machine-kubermatic-fhgbvx65xg-7flj7 7d machine-kubermatic-fhgbvx65xg-hmgd4

    7d machine-kubermatic-fhgbvx65xg-q287t 7d scalable-machine-deployment-hueab94ghq-abiur 3m scalable-machine-deployment-hueab94ghq-4uhva 3m scalable-machine-deployment-hueab94ghq-vhues 3m