Education › Forward Deployed › Stage 4: Deploying in customer environments

Packaging and deploying to customer infrastructure

Containers, Helm charts and configuration that installs cleanly into a cluster you do not own.

Intermediate to advanced ~45 min read Module 13 of 20

Deploying into your own cloud is easy; deploying into a customer's Kubernetes cluster that you do not own, with their registry, their policies, their ingress, their secrets and their security team watching, is a skill. This lesson covers building container images that pass enterprise scanners and admission policies, writing a Helm chart that adapts to any reasonable cluster through values instead of edits, the install and upgrade workflow customers expect, and the cluster quirks, such as restricted pod security and OpenShift's random user IDs, that break naive deployments.

After this module you can
  • Build small, non-root, pinned, multi-architecture images with an SBOM
  • Design a Helm chart whose values cover registries, secrets, ingress and scheduling
  • Meet restricted pod security and least-privilege RBAC requirements
  • Validate, install, upgrade and roll back with Helm safely
  • Write installation docs and preflight checks customers can follow without you

Images enterprises will accept

Customer platforms scan every image and often enforce admission policies. Images that run as root, carry hundreds of known vulnerabilities, or float on a latest tag get rejected or flagged. Build images as if a security reviewer will read the Dockerfile, because one will.

A small, non-root, reproducible Python service image
dockerfile
FROM python:3.12-slim AS build
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN pip install --no-cache-dir uv && uv export --frozen --no-dev -o requirements.txt \
 && pip install --no-cache-dir --prefix=/install -r requirements.txt

FROM python:3.12-slim
RUN useradd --uid 10001 --create-home app
COPY --from=build /install /usr/local
COPY --chown=10001:0 src/ /app/src/
WORKDIR /app
USER 10001
EXPOSE 8000
CMD ["python", "-m", "uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "8000"]
  • Non-root user with a fixed numeric UID, and files group-owned by 0 so platforms that assign random UIDs (OpenShift) still work.
  • Minimal base and multi-stage builds: build tools stay out of the runtime image.
  • Pinned versions and release tags (and digests in the chart) so what was tested is what runs.
  • Multi-architecture builds (amd64 and arm64) with docker buildx, because customer fleets increasingly include ARM nodes.
  • SBOM and signature: publish a software bill of materials and sign images (for example with cosign) so the customer can verify provenance.

A Helm chart that adapts instead of being edited

If a customer has to edit your templates to install your product, every upgrade becomes a merge conflict. Expose everything that legitimately differs between clusters as values with sensible defaults, and keep templates generic.

mirrorregistry, secrets, proxyrenderinstallimage refsYour releaseimage + chartTheir registrymirrored imagevalues.yamltheir Git repoHelmtemplate, upgradeNamespacerestricted PSSPlatform reviewrendered YAML
The same chart installs anywhere because everything cluster-specific comes from the customer's values: their registry, secrets, ingress, proxy and CA.
values.yaml: the knobs customer clusters actually need
yaml
image:
  registry: registry.yourproduct.example     # customers override with their mirror
  repository: assistant/api
  tag: "1.8.2"
  pullPolicy: IfNotPresent
imagePullSecrets: []                         # e.g. [{name: corp-registry}]

replicaCount: 2
resources:
  requests: {cpu: 250m, memory: 512Mi}
  limits: {memory: 1Gi}

existingSecret: ""                           # use the customer's secret instead of creating one
env:
  LOG_LEVEL: info

ingress:
  enabled: false
  className: ""                              # nginx, openshift-default, alb ...
  host: assistant.corp.example
  tlsSecretName: ""

nodeSelector: {}
tolerations: []
affinity: {}
podSecurityContext:
  runAsNonRoot: true
  seccompProfile: {type: RuntimeDefault}
securityContext:
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities: {drop: ["ALL"]}

proxy:
  httpsProxy: ""
  noProxy: ".svc,.cluster.local"
caBundleConfigMap: ""                        # customer CA mounted into the pod

Support existing secrets (the customer creates and rotates them, often from their vault) rather than requiring secret values in values.yaml. Make registry, ingress class, storage class, proxy settings and CA bundle configurable. Ship a values.schema.json so typos fail at install time instead of producing a silently wrong deployment.

Security posture: pod security and RBAC

Many clusters enforce the Kubernetes restricted Pod Security Standard: non-root, no privilege escalation, all capabilities dropped, a seccomp profile. The values above satisfy it; test your chart in a namespace labelled pod-security.kubernetes.io/enforce: restricted before any customer does.

  • Request namespaced RBAC only: a Role and RoleBinding for what the app needs, never cluster-admin.
  • If you truly need cluster-scoped resources (CRDs, webhooks), separate them into an optional install step that the platform team runs and reviews.
  • Use a read-only root filesystem and mount writable emptyDir volumes only where needed (/tmp, caches).
  • Define readiness and liveness probes, resource requests and limits, and a PodDisruptionBudget so platform maintenance does not take you down.
  • Expect network policies: document every connection your pods make so the customer can allow them.

Install, upgrade and roll back

The workflow customers can run themselves
bash
helm lint ./assistant -f customer-values.yaml
# render and review before applying
helm template assistant ./assistant -f customer-values.yaml > rendered.yaml
helm upgrade --install assistant ./assistant -n assistant --create-namespace \
  -f customer-values.yaml --atomic --timeout 10m
helm history assistant -n assistant
helm rollback assistant 3 -n assistant   # back to revision 3 if the upgrade misbehaves
  • helm template lets the customer's platform team review exactly what will be applied; many require it.
  • --atomic rolls back automatically if the release does not become healthy within the timeout.
  • Keep the customer's values file in their version control; upgrades become a chart version bump plus a diff review.
  • Document breaking changes and migration steps in release notes for every chart version.

Docs and preflight checks

The installation guide is part of the product. It should list prerequisites (Kubernetes version range, storage class, ingress controller, GPU nodes if needed, outbound destinations), a minimal values file for a typical install, the commands above, how to verify the install, and how to uninstall cleanly. Add a preflight script or Helm test that checks the environment before installing: can pods pull the image, resolve and reach the database, trust the CA, get through the proxy? Failing early with a clear message saves days of remote debugging.

Hands-on practice

Package a service for a cluster you do not own

  1. Write the Dockerfile from this lesson for a small FastAPI service, build it for amd64 and arm64 with buildx, and scan it with an open-source scanner (for example Trivy).
  2. Create a Helm chart with the values from this lesson, including existingSecret, ingress, proxy and CA bundle options, and a values.schema.json.
  3. Create a kind cluster and a namespace labelled to enforce the restricted Pod Security Standard; install the chart and fix anything rejected.
  4. Install from a local registry mirror by overriding image.registry, using an imagePullSecret.
  5. Upgrade to a new image tag with --atomic, then deliberately ship a broken version and watch the automatic rollback.
  6. Write a one-page installation guide with prerequisites, minimal values, verify and uninstall steps, and have someone follow it cold.
Cheat sheet

Packaging and deploying to customer infrastructure — at a glance

Main things to focus on

  • Non-root, minimal, pinned, multi-arch images with SBOM and signature.
  • Everything cluster-specific is a value; customers never edit templates.
  • Support existing secrets, registry mirrors, proxies and CA bundles.
  • Pass the restricted Pod Security Standard; namespaced RBAC only.
  • helm template for review, upgrade --install --atomic, rollback ready.
  • Installation guide and preflight checks are part of the product.

Images

USER 10001 (files group 0)Non-root, OpenShift-friendly
docker buildx build --platform linux/amd64,linux/arm64Multi-arch
trivy image IMAGEVulnerability scan
cosign sign IMAGE@DIGESTSign for provenance

Helm

helm lint CHART -f VALUESStatic checks
helm template NAME CHART -f VALUESRender for review
helm upgrade --install ... --atomic --timeout 10mInstall or upgrade safely
helm history / helm rollback NAME REVRevisions and rollback
values.schema.jsonValidate values at install

Restricted pod security

runAsNonRoot: trueNo root
allowPrivilegeEscalation: falseNo escalation
capabilities: {drop: [ALL]}No extra capabilities
seccompProfile: {type: RuntimeDefault}Seccomp required
readOnlyRootFilesystem: true + emptyDirWritable only where needed

Chart values customers need

image.registry / imagePullSecretsTheir mirror
existingSecretTheir secret management
ingress.className / host / tlsTheir ingress
nodeSelector / tolerations / affinityTheir scheduling rules

Common pitfalls

  • Images that run as root or use the latest tag.
  • Requiring cluster-admin to install an application.
  • Secrets that must be pasted into values.yaml.
  • Hard-coded registry, ingress class or storage class in templates.
  • Never testing under the restricted Pod Security Standard or on OpenShift.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →