Long-running service
A Deployment, ClusterIP Service and Ingress that pass Kestrel’s admission rules. nginxinc/nginx-unprivileged stands in for your app: replace the image, port and resources. Commit the manifests to the path your ArgoCD Application syncs (for example manifests/my-service/) and replace <tenant>.
Before you start:
- Create the namespace:
kubectl create namespace <tenant>-prod. - Ask RCS (ticket) for a DNS record for
my-service.<tenant>.kestrel.arbutus.cloud, and to enable certificates for your tenant if that isn’t done yet. Creating an Ingress does neither. See Ingress and TLS.
Deployment
Section titled “Deployment”Kyverno enforces the PodSecurity restricted profile on every Pod, so keep the securityContext fields. readOnlyRootFilesystem is optional hardening; it is why nginx gets three emptyDir mounts.
One replica, no probes, and uber-user-significant, which never preempts other Pods.
apiVersion: apps/v1kind: Deploymentmetadata: name: my-service namespace: <tenant>-prodspec: replicas: 1 selector: matchLabels: app: my-service template: metadata: labels: app: my-service spec: priorityClassName: uber-user-significant securityContext: runAsNonRoot: true runAsUser: 101 seccompProfile: type: RuntimeDefault containers: - name: nginx image: nginxinc/nginx-unprivileged:1.27-alpine ports: - containerPort: 8080 securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: [ALL] resources: requests: cpu: 100m memory: 64Mi limits: cpu: 200m memory: 128Mi volumeMounts: - name: tmp mountPath: /tmp - name: cache mountPath: /var/cache/nginx - name: run mountPath: /var/run volumes: - name: tmp emptyDir: {} - name: cache emptyDir: {} - name: run emptyDir: {}Two replicas spread across nodes by a soft anti-affinity rule, probes, and uber-user-preempt-high, the class for production services behind an Ingress.
apiVersion: apps/v1kind: Deploymentmetadata: name: my-service namespace: <tenant>-prodspec: replicas: 2 selector: matchLabels: app: my-service template: metadata: labels: app: my-service spec: priorityClassName: uber-user-preempt-high securityContext: runAsNonRoot: true runAsUser: 101 seccompProfile: type: RuntimeDefault affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchLabels: app: my-service topologyKey: kubernetes.io/hostname containers: - name: nginx image: nginxinc/nginx-unprivileged:1.27-alpine ports: - containerPort: 8080 livenessProbe: httpGet: path: / port: 8080 initialDelaySeconds: 5 periodSeconds: 10 readinessProbe: httpGet: path: / port: 8080 initialDelaySeconds: 3 periodSeconds: 5 securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: [ALL] resources: requests: cpu: 100m memory: 64Mi limits: cpu: 200m memory: 128Mi volumeMounts: - name: tmp mountPath: /tmp - name: cache mountPath: /var/cache/nginx - name: run mountPath: /var/run volumes: - name: tmp emptyDir: {} - name: cache emptyDir: {} - name: run emptyDir: {}Adding a persistent volume
Section titled “Adding a persistent volume”Cinder volumes are ReadWriteOnce: one node at a time. A Deployment that mounts one needs a single replica and the Recreate strategy; with the default RollingUpdate, a new Pod that lands on another node stalls with Multi-Attach error. For more than one replica, use a StatefulSet. The fresh volume is root:root 0755, so set fsGroup too. Merge these fields into the Minimal manifest:
spec: replicas: 1 strategy: type: Recreate # RWO volume: the old Pod must release it first template: spec: securityContext: fsGroup: 101 # makes the volume writable for nginx (UID/GID 101) fsGroupChangePolicy: OnRootMismatch containers: - name: nginx volumeMounts: - name: data mountPath: /data volumes: - name: data persistentVolumeClaim: claimName: my-service-dataSee Storage classes and Persistent volumes.
Service and Ingress
Section titled “Service and Ingress”apiVersion: v1kind: Servicemetadata: name: my-service namespace: <tenant>-prodspec: type: ClusterIP selector: app: my-service ports: - port: 80 targetPort: 8080apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: my-service namespace: <tenant>-prod annotations: cert-manager.io/cluster-issuer: letsencrypt-prod traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true"spec: ingressClassName: traefik tls: - hosts: - my-service.<tenant>.kestrel.arbutus.cloud secretName: my-service-tls rules: - host: my-service.<tenant>.kestrel.arbutus.cloud http: paths: - path: / pathType: Prefix backend: service: name: my-service port: number: 80- Services must be
ClusterIP.LoadBalancer,NodePortandExternalNameare denied; see Service types. - The
websecureentrypoint makes the route HTTPS-only:http://returns 404. - While testing, use
letsencrypt-staging(browsers will warn about its certificates). The Let’s Encrypt rate limit forarbutus.cloudis shared by every tenant; see TLS.
Verify
Section titled “Verify”kubectl get pods,svc,ingress,certificate -n <tenant>-prodkubectl logs -n <tenant>-prod deployment/my-servicecurl -I https://my-service.<tenant>.kestrel.arbutus.cloud/The Certificate my-service-tls can be READY: True before the hostname resolves, because cert-manager validates it with DNS01 against RCS’s DNS, not over HTTP. The URL works once RCS has created the DNS record.
If something goes wrong
Section titled “If something goes wrong”| Symptom | Cause and fix |
|---|---|
Application Synced, but no Pods; kubectl describe rs -n <tenant>-prod shows a validate.kyverno.svc-fail PodSecurity denial | A required securityContext field is missing. The denial appears only in the ReplicaSet’s events, not in ArgoCD or on the Deployment. |
Pod Pending with Insufficient cpu or Insufficient memory | No node has room. This is node capacity, not quota. The anti-affinity rule is preferred, so it never blocks scheduling. |
New Pod stuck in ContainerCreating with Multi-Attach error | The Deployment mounts an RWO volume with RollingUpdate. Use the Recreate strategy (see above). |
For other messages, see the Troubleshooting index.