Schedule pods to start and stop in Kubernetes by date and time

June 24, 2021

Kubernetes by default doesn't provide this feature but you can use Another Autoscaler controller for that.

We are using this tool in my company to save some money on the Kubernetes clusters with GPU instances (P2 and G4DN); Developers using these types of instances generally use them during working hours, so we can terminate pods after working hours and our Cluster Autoscaler will scale-down instances that are idle.

Another Autoscaler page: https://github.com/dignajar/another-autoscaler

Read more



Kubernetes: Wait until another pod is ready

November 2, 2020

The idea is to wait inside an init-container until the health check is successful. The health check, in this case, is the HTTP response code equal to 200.

  • This init-container will continue after the service returns 200.
  • If the init-container doesn't complete, the container will not be executed.
initContainers:
- name: wait-for-webserver
  image: curlimages/curl:latest
  command: ["/bin/sh","-c"]
  args: ["while [ $(curl -sw '%{http_code}' http://webserver.svc.cluster.local -o /dev/null) -ne 200 ]; do sleep 5; echo 'Waiting for the webserver...'; done"]
Read more

Kubernetes: Global environment variables for pods

September 30, 2020

I was trying to insert a few global environment variables to every container running, so one of the options was Pod Presets but I realized this feature will be removed in Kubernetes 1.20.x, check this pull request).

One of the solution is create a ConfigMap and use the envFrom to define all of the ConfigMap's data as container environment variables.

Read more

Persistent volume in Kubernetes cluster with multiple availability zones

August 25, 2020

After a wild using Kubernetes in AWS and set-up persistent volumes via EBS, I faced a problem with evicted pods after they are re-schedule to another node; The issue was the EBS volumes are dedicated by zone, makes sense because the volumes work via networking and are dedicated per datacenter, for the network latency.

Read more