Reference example · Lean service

Go values.

A statically compiled Go service with a mounted configuration file.

values.yaml

replicaCount: 2
image: ghcr.io/example-org/go
imageTag: "1.0.0"
imagePullPolicy: IfNotPresent

service:
  port: 8080

securityContext:
  runAsNonRoot: true
  runAsUser: 10001
  runAsGroup: 10001
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities:
    drop: ["ALL"]
podSecurityContext:
  seccompProfile:
    type: RuntimeDefault

env:
  - name: APP_ENV
    value: production
envFrom:
  - configMapRef:
      name: go-config
configMaps:
  - name: go-config
    mountPath: /etc/example
    readOnly: true
    data:
      app.yaml: |
        logLevel: info
        gracefulShutdown: 15s

resources:
  requests: {cpu: 25m, memory: 64Mi}
  limits: {cpu: 250m, memory: 256Mi}
readinessProbe:
  httpGet: {path: /health, port: http}
livenessProbe:
  httpGet: {path: /health, port: http}
route:
  enabled: true
  gateway: external
  gatewayNamespace: gateway-system
  sectionName: https
  hostname: go.example.com

Deploy

helm upgrade --install go universal/application \
  --namespace apps --create-namespace \
  --values values.yaml

Result

kubectl get pods -l app.kubernetes.io/instance=go
NAME                    READY   STATUS
go-6f8f5d7c87-abcde      1/1     Running

curl -fsS https://go.example.com/health
{"status":"ok"}

Package

Artifact Hub →