gke-node-pool-shifter

by rimusz

Helm chartv0.1.0App 1.0.21MIT

A Helm chart for gke-node-pool-shifter

About this chart

GKE node-pool shifter

This controller shifts nodes from one GKE node pool to another, in order to favour preemptibles over a 'safety net' node pool of regular VMs.

In more details: controller moves regular VMs over to the preemptible node pool, by adding a preemptible VM and deleting a regular VM whenever one is added by the GKE cluster autoscaler.

You can read more about the use case on Travix Engineering blog post.

Prerequisites

  • Kubernetes cluster on Google Container Engine (GKE)
  • GCP Service account with role set to Compute Instance Admin and Kubernetes Engine Admin. This key is going to be used to authenticate from the application to the GCP Compute API. See documentation.

Installing the Chart

To install the chart with the release name gke-node-pool-shifter:

helm upgrade --install gke-node-pool-shifter --namespace estafette rimusz/gke-node-pool-shifter \
    --set googleServiceAccount="$(cat path_to_your/google-service-account.json | base64)"

Installing with existing secret

You can deploy the Google service account google-service-account.json file as a Kubernetes secret.

Create the Kubernetes secret:

kubectl create secret generic gke-node-pool-shifter -n estafette --from-file=path_to_your/google-service-account.json

Pass the configuration file to helm:

helm upgrade --install gke-node-pool-shifter --namespace estafette rimusz/gke-node-pool-shifter \
    --set existingSecret="gke-node-pool-shifter"

NOTE: You have to keep passing the configuration file secret parameter as --set existingSecret="gke-node-pool-shifter" on all future calls to helm upgrade or set it in values.yaml file existingSecret: gke-node-pool-shifter!

Uninstalling the Chart

To uninstall/delete the gke-node-pool-shifter deployment:

helm delete --purge gke-node-pool-shifter

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the kubernetes-dashboard chart and their default values.

ParameterDescriptionDefault
image.repositoryImage repository nameestafette/estafette-gke-preemptible-killer
image.pullPolicyImage pull policyIfNotPresent
image.pullSecretsImage pull secret from private registry``
googleServiceAccountbase64 encoded google-service-account.json file``
existingSecretSpecifies an existing secret for google-service-account.json file``
nodePool.intervalTime in second to wait between each node pool check300
nodePool.fromThe name of the node pool to shift from``
nodePool.toThe name of the node pool to shift to``
nodePool.fromMinNodeThe minimum number of nodes to keep for the node pool to shift from0
securityContext.enabledEnables Security Contexttrue
securityContext.userIdSecurity User Id1000
securityContext.groupIdSecurity Group Id1000
annotations.prometheus.io/scrapeThe address to listen on for Prometheus metrics requeststrue
annotations.prometheus.io/portThe port to listen for Prometheus metrics requests9001
livenessProbeSet liveness probe{}
resources.limits.cpuSpecifies CPU limit50m
resources.limits.memorySpecifies memory limit128Mi
resources.requests.cpuSpecifies CPU request10m
resources.requests.memorySpecifies memory request16Mi
nodeSelectorgke-node-pool-shifter node selector{}
tolerationsgke-node-pool-shifter node tolerations[]
affinitygke-node-pool-shifter node affinitycloud.google.com/gke-preemptible
podDisruptionBudget.enabledEnables Pod Disruption Budgetfalse
podDisruptionBudget.maxUnavailableMax unavailable Pods1
podDisruptionBudget.minAvailablemin unavailable Pods``
rbac.enabledSpecifies whether RBAC resources should be createdtrue

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

helm upgrade --install gke-node-pool-shifter --namespace estafette rimusz/gke-node-pool-shifter --set resources.limits.cpu=200m

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

helm upgrade --install gke-node-pool-shifter --namespace estafette rimusz/gke-node-pool-shifter -f values.yaml

Tip: You can use the default values.yaml

Deploy gke-node-pool-shifter with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has gke-node-pool-shifter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgke-node-pool-shifter is pinned at v0.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply