Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Last active January 5, 2024 15:47
Show Gist options
  • Save coryodaniel/8822577fd0dfd22da60ebee54a8687c5 to your computer and use it in GitHub Desktop.
Save coryodaniel/8822577fd0dfd22da60ebee54a8687c5 to your computer and use it in GitHub Desktop.
Setting GOMAXPROCS to resource limits cpu using Kubernetes downward API
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mycontainer
image: myimage
resources:
limits:
cpu: "2"
env:
- name: GOMAXPROCS
valueFrom:
resourceFieldRef:
containerName: mycontainer
resource: limits.cpu
# divisor: necessary if setting w millicpu + probably an entry point to round if a decimal value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment