February 20, 2024 | 00:00

Kubernetes Downward API

Sometimes you want to expose information about the constraints the container is running without duplicating values or have the application reach out to the Kubernetes API. The Downward API helps with this problem where you can inject pod information to the container via env variables. For example, let’s imagine we want to set the GOMAXPROCS depending on the CPU limit: apiVersion: v1 kind: Pod metadata: name: my-app spec: containers: - name: my-app image: golang resources: requests: memory: "32Mi" cpu: "125m" limits: memory: "64Mi" cpu: "250m" env: - name: GOMAXPROCS valueFrom: resourceFieldRef: containerName: my-app resource: limits. Read more

August 16, 2020 | 19:17

Deploy long-running tasks on Kubernetes

Whilst reading this extremly detailed and well written article about how graceful shutdowns work on Kubernetes. It touched on the subject of long running tasks. When we update the deployment inside of Kubernetes, it will start by deleting a pod with the old version of the image, and starts a new pod with the new version. The pod can be attached to a service it might be the case that the pod is removed from the service before the process/pod has finished. Read more