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

Kubernetes multiple zones and autoscaling

July 6, 2020

After a while using Kubernetes, I tried to improve the cluster and try to use all the features from the cloud provider such as the autoscaling groups and multiple availability zones.

The environment

  • AWS (The idea is the same for other cloud providers)
  • Kubernetes
  • Autoscaling groups for the workes for each availability zone (zone-a, zone-b, zone-c).
  • Cluster-Autoscaler (CA)

The cluster will scale when:

  • There are pods that failed to run in the cluster due to insufficient resources.
  • There are nodes in the cluster that have been underutilized for an extended period of time and their pods can be placed on other existing nodes.
Read more

Trigger Jenkins jobs via API and curl

April 23, 2020

After upgrade Jenkins, we face an issue (Error 403 No valid crumb was included in the request). We have a few solution they need to trigger Jenkins's job externally via curl command before they start working. For trigger jobs we use a service account in Jenkins.

Read more


Kubernetes: Delete pods older than X days

February 14, 2020

I'm working with Airflow and the Kubernetes operator which deploys from Airflow a container to Kubernetes. The pods created by Airflow have ended so the final status of the pod could be Succeeded or Failed. I was looking for to delete the pods created by Airflow but older than 5 days, so we can still read the logs from the pods until they are deleted.

Read more