Skip to content

Code to Production 06: The Platform on NKP

Take everything the platform gives you, bring your own piece only where its version doesn't fit, and put every cluster-wide change in one script a person runs. That's the whole platform design for eShop on Nutanix Kubernetes Platform (NKP) 2.19.1. This post shows the cluster layout, the three identities, the Gateway, the data, the Secrets, and the pitfalls each part guards against.


This isn't an NKP admin guide. Creating clusters, upgrades, identity providers and platform backup are in Nutanix's own documentation1. What follows is how one application uses NKP as a tenant.

Two clusters, and eShop touches the management one exactly once

NKP gives you a management cluster that runs the lifecycle tooling and the console, and workload clusters that run your applications. The lab has one of each, both on NKP v2.19.1 and Kubernetes v1.36.2.

NKP Ultimate dashboard, Global view, with the Management Cluster card, a Clusters card showing 2 clusters and a Workspaces card

The NKP console on the management cluster: v2.19.1, Kubernetes v1.36.2, two clusters, two workspaces. The two "Clusters with Warnings" are resource warnings, explained below.

Cluster Role What eShop has there
nkp-prd1 management one ConfigMap and one patch: a monitoring values override
eshop-prd1 workload everything else: dev, QA, prod, the shared mocks, tracing, eShop's Gateway

NKP Clusters page with nkp-prd1 marked Management and eshop-prd1 in the Default Workspace, each with CPU and memory bars

eshop-prd1 sits in the Default Workspace. Look at its CPU limits: 109% of what the nodes have, with requests at 84%.

eshop-prd1 has six nodes: three control-plane, three workers from the node pool md-0, all Rocky Linux 9.8 with containerd. All three environments run side by side in this one workload cluster. That's a lab decision, and the 109% limits bar is the price: one small cluster carries three environments, the mocks and the whole monitoring stack.

Diagram of the management cluster nkp-prd1 and the workload cluster eshop-prd1, with three groups: installed by NKP, installed by eShop's bootstrap.sh, and applied by Flux as eshop-deployer

Three owners in one cluster: NKP installs the grey group, a cluster admin running bootstrap.sh installs the blue group, and Flux applies the green one as eshop-deployer.

What NKP provides, and the four pieces eShop brings

NKP provides eShop uses it for
Cilium pod networking and network policies
MetalLB the LoadBalancer address of eShop's Gateway, <GATEWAY>
cert-manager eShop's own CA and the Gateway's certificate
Gateway API CRDs v1.3.0 the Gateway and HTTPRoute kinds; eShop adds no CRDs
kube-prometheus-stack, Loki, Logging Operator metrics, dashboards, alerts, pod logs
Rook Ceph object storage (dkp-object-store) for traces
opentelemetry-operator injecting the .NET tracing agent
Flux, in kommander-flux pull-based deploys of all four eShop namespaces

The first four come with every NKP cluster. The rest are switched on per workspace, one AppDeployment object each on the management cluster.

NKP Applications page for the Default Workspace showing 35 applications, 14 enabled, and the Logging group with Grafana Logging, Grafana Loki, Logging Operator, Rook Ceph and Rook Ceph Cluster enabled

14 of 35 platform applications enabled. Each "Enabled" tile is an AppDeployment in the workspace's namespace kommander-default-workspace.

eshop-prd1 detail page in the NKP console with Enabled Applications tiles for Grafana, Prometheus, Prometheus Alertmanager, Grafana Logging, Rook Ceph Cluster and Traefik

The monitoring stack eShop uses runs on the workload cluster itself: Grafana v13.1.0, Prometheus v3.13.1, Alertmanager v0.33.1.

Four pieces are eShop's own, installed with Helm at exact chart versions:

Piece Chart, version Namespace Why not NKP's
Traefik v3.5.3 traefik 37.2.0 eshop-traefik NKP's Traefik v3.6 can't serve Gateway API v1.3
CloudNativePG 1.30.1 cloudnative-pg 0.29.1 cnpg-system eShop pins the version and the image digest
policy-controller v0.13.1 policy-controller 0.10.8 cosign-system not an NKP application
Grafana Tempo 2.10.8 tempo 2.4.0 eshop-tracing not an NKP application

Flux is the opposite call: eShop uses NKP's and installs none. ADR 0017, "The cluster pulls its manifests, signed; the pipeline stops applying them", chooses Flux over Argo CD because it's already there, run and upgraded by NKP. eShop's OCIRepository and Kustomization objects live in its own namespace eshop-ci, so an NKP upgrade doesn't touch them. The trade: eShop doesn't choose Flux's version, and a Flux outage stops deploys. Post 05 covers the pull flow.

The one change on the management cluster is a values override for kube-prometheus-stack. You don't edit an NKP-owned Helm release on the workload cluster, because NKP puts it back. You create a ConfigMap in the workspace namespace and name it in the AppDeployment's configOverrides:

# eshop-infra/clusters/eshop-prd1/platform/nkp-monitoring-overrides.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: kube-prometheus-stack-eshop-overrides
  namespace: kommander-default-workspace
data:
  values.yaml: |
    prometheus:
      prometheusSpec:
        enableRemoteWriteReceiver: true
    grafana:
      sidecar:
        datasources:
          initDatasources: true
          watchMethod: LIST

One idempotent script holds everything cluster-wide

Everything eShop installs that isn't an application manifest is in eshop-infra/clusters/eshop-prd1/bootstrap.sh. A cluster admin runs it; CI never does.

clusters/eshop-prd1/bootstrap.sh ../eshop-prd1.conf

It has ten numbered steps: CloudNativePG, eShop's Traefik (with --skip-crds, so none of NKP's CRDs change), the namespaces and three identities, the CA and Gateway, policy-controller and the Flux objects, the Secrets, tracing, the pipelines exporter, the alert rules, the probe.

Every step either converges (helm upgrade --install, kubectl apply) or checks first, so the same script serves a first install, a one-file change and a check after an NKP upgrade. The rebuild guide runs it three times on purpose. When an input only a person can give is missing (the public signing key, the exporter's token), it says "skipped" and continues. It never invents a value.

The trade is real: platform changes aren't continuous. A merge that changes platform/gateway.yaml deploys nothing until somebody runs the script.

Pitfalls: five NKP traps, each with a guard

Pitfall Why it happens The guard in place
eShop's CloudNativePG install fails NKP's own cloudnative-pg application, when enabled, owns the *.cnpg.io CRDs; two installs can't own the same CRDs the rebuild guide lists "NKP's cloudnative-pg not enabled" as a precondition. If it's enabled: delete its AppDeployment for the workspace, remove the leftover CRDs while no PostgreSQL cluster exists, then run the script
An AppDeployment exists, the console shows it, nothing appears on eshop-prd1 without spec.clusterSelector, NKP deploys to no cluster and reports no error each one gets kommander.d2iq.io/cluster-name In [eshop-prd1], and the check is on the workload cluster, not the console
The opentelemetry-operator AppDeployment doesn't resolve it's a workspace App, not a ClusterApp like the others appRef: {kind: App, name: opentelemetry-operator-0.114.1}
Grafana shows none of eShop's data sources Grafana reads data sources once at start, and on a new cluster it starts before bootstrap step 7 creates them one restart after bootstrap (below)
CloudNativePG's Helm release sticks in pending-install the release record is about 1 MB; over a slow VPN the upload doesn't finish in 60 seconds, and every later run refuses with "another operation is in progress" run bootstrap.sh from the runner VM, next to the cluster
kubectl -n kommander-default-workspace rollout restart deploy/kube-prometheus-stack-grafana

The CloudNativePG conflict has a lasting cost. Other NKP applications depend on NKP's CloudNativePG (the vendor notes list NKP's Harbor, AI Navigator and NKP Insights), and they can't be enabled on this workspace without solving the ownership question again.

One namespace per environment, plus two that aren't environments

eshop-prd1 Namespaces tab in the NKP console listing 25 namespaces, including cnpg-system, cosign-system, eshop-ci, eshop-dev, eshop-prod and eshop-qa

25 namespaces. eShop's sit next to NKP's: eshop-ci, eshop-dev, eshop-prod, eshop-qa, and further down eshop-tracing, eshop-traefik, gateway and thirdparty.

Namespace Holds
eshop-dev, eshop-qa, eshop-prod one environment each: four services and PostgreSQL
thirdparty the shared mocks and the load generator
eshop-ci no pods: three ServiceAccounts and Flux's objects per environment

The four application namespaces carry two labels that other parts of the platform read as switches:

# eshop-infra/clusters/eshop-prd1/eshop-deployer.yaml
kind: Namespace
metadata:
  name: eshop-dev
  labels:
    app.kubernetes.io/part-of: eshop
    eshop.io/gateway-access: "true"     # the Gateway's listeners admit its HTTPRoutes
    policy.sigstore.dev/include: "true" # its images are checked by the image policy

That second label puts the namespace under the signed-image policy, which is post 04's subject.

Three identities: the one that writes never leaves the cluster

Three ServiceAccounts in eshop-ci act on the four namespaces. Each has one job.

Identity Who acts as it What it may do Where a token lives
eshop-deployer Flux, by impersonation change what the manifests create, in four namespaces nowhere outside the cluster
eshop-ci-reader GitLab CI: deploy jobs, watchdog, re-scan read the four namespaces, Flux's objects, one Secret the protected File variable ESHOP_PRD1_KUBECONFIG
eshop-reader a person with kubectl read the four namespaces; no Secrets, no Flux objects a kubeconfig that expires in 24 hours by default

The deployer is one ClusterRole bound by four RoleBindings, so it has no cluster-wide right. Each Flux Kustomization names it in serviceAccountName, and Flux impersonates it for every apply2. Its rules are exactly the kinds under deploy/: ConfigMaps, Services, PVCs, Deployments, NetworkPolicies, CiliumNetworkPolicies, HTTPRoutes and CloudNativePG Clusters. It can't create a namespace, a Role, a StatefulSet or a Job, and it can't touch the Gateway or the image policy.

CI's reader exists because of ADR 0017. Even a narrow deployer token in a CI variable could change every workload in four namespaces, so it "stays worth stealing". A stolen CI kubeconfig shows an attacker the workloads and one test account's password. It changes nothing.

The script that installs CI's kubeconfig, ci-kubeconfig.sh, proves the rights with the new file before it replaces the variable. If any write check answers yes, it installs nothing. Here's the same set of questions, asked as a cluster admin:

kubectl auth can-i patch deployments -n eshop-prod \
  --as=system:serviceaccount:eshop-ci:eshop-ci-reader
What CI's identity, eshop-ci/eshop-ci-reader, may do (kubectl auth can-i):
list pods -n eshop-prod                                        yes
get clusters.postgresql.cnpg.io -n eshop-prod                  yes
get secret/eshop-api-staff -n eshop-prod                       yes
get secret/eshop-db-credentials -n eshop-prod                  no
list secrets -n eshop-prod                                     no
patch deployments -n eshop-prod                                no
create pods -n eshop-prod                                      no
get kustomizations.kustomize.toolkit.fluxcd.io -n eshop-ci     yes
patch kustomizations.kustomize.toolkit.fluxcd.io -n eshop-ci   no
list pods -n kube-system                                       no

People's reader is Kubernetes' built-in view plus a small ClusterRole for the add-on kinds view doesn't cover (HTTPRoute, CloudNativePG Cluster, CiliumNetworkPolicy, Instrumentation). reader-kubeconfig.sh writes one person a file, checks it can list pods and can't read Secrets, and deletes the file if either check fails.

CI and people get separate readers on purpose. A person's file never carries the right to read a password, and revoking every person's access doesn't touch the pipeline.

Pitfall: a Secret rule with no name reads every Secret

A get on Secrets without resourceNames lets whoever acts as that role read the database password, the token signing key and every share account, if it names them.

So the deployer may read one Secret by name: eshop-api-staff, the account the smoke test signs in with. CI's reader has the same one-name rule.

# eshop-infra/clusters/eshop-prd1/eshop-deployer.yaml
  - apiGroups: [""]
    resources: [secrets]
    resourceNames: [eshop-api-staff]
    verbs: [get]

The control that checks it is the config gate from post 03: Trivy reports a Role that may read Secrets as KSV-0041 (CRITICAL), and the gate fails the pipeline on it. A one-name rule trips KSV-0041 too, and it's as narrow as a rule gets. So each of the two rules has a written reason with an expiry date in scripts/gates/config-accepted.txt (ADR 0016), and any other Role that reads Secrets fails the gate.

A second Traefik serves the Gateway API, and NKP's stays untouched

ADR 0002, "Gateway API on the bundled Traefik instead of NGINX", puts the Kubernetes Gateway API at the front door, so the Gateway and HTTPRoutes stay portable to any implementation3. On NKP the bundled Traefik can't be that implementation. NKP 2.19 ships Traefik v3.6, whose Gateway provider needs Gateway API v1.4, and NKP ships the v1.3.0 CRDs. The provider never starts, so a Gateway attached to NKP's class is never Programmed.

Replacing NKP's CRDs with v1.4 would change something NKP owns and upgrades. So eShop runs its own Traefik v3.5.3, which supports v1.3.0, and NKP's Traefik keeps serving Ingresses untouched. The HTTPRoutes are plain Gateway API, so they don't depend on which Traefik serves them.

Both Traefiks use the controller name traefik.io/gateway-controller, so the values file keeps them apart three ways:

# eshop-infra/clusters/eshop-prd1/platform/traefik-values.yaml
service:
  annotations:
    metallb.io/loadBalancerIPs: <GATEWAY>
deployment:
  replicas: 2
# Gateway API only: NKP's Traefik keeps serving Ingresses and IngressRoutes.
providers:
  kubernetesCRD:
    enabled: false
  kubernetesIngress:
    enabled: false
  kubernetesGateway:
    enabled: true
    labelselector: eshop.io/gateway-class=eshop
    namespaces: [eshop-traefik, gateway, eshop-dev, eshop-qa, eshop-prod, thirdparty]

One gotcha: a Gateway's class can't be changed in place. bootstrap.sh step 4 deletes a Gateway eshop that still names another class and creates it again.

nip.io hostnames, one listener per environment

The lab runs no DNS zone. The hostnames are nip.io names, which resolve to the IP address embedded in them4: eshop.<GATEWAY>.nip.io for dev and the mocks, qa.eshop.<GATEWAY>.nip.io and prod.eshop.<GATEWAY>.nip.io for the other two.

$ kubectl get gateway -A
NAMESPACE   NAME    CLASS           ADDRESS       PROGRAMMED   AGE
gateway     eshop   eshop-traefik   <GATEWAY>     True         4h36m

The one Gateway has six listeners, HTTPS and HTTP per hostname. allowedRoutes is the access control between environments at the front door:

# eshop-infra/clusters/eshop-prd1/platform/gateway.yaml
    - name: https-prod
      protocol: HTTPS
      port: 8443
      hostname: prod.eshop.<GATEWAY>.nip.io
      tls:
        mode: Terminate
        certificateRefs:
          - name: eshop-tls
      allowedRoutes:
        namespaces:
          from: Selector
          selector:
            matchLabels:
              kubernetes.io/metadata.name: eshop-prod

Kubernetes sets kubernetes.io/metadata.name itself, so labelling another namespace can't forge it. The dev listener is looser: it admits any namespace labelled eshop.io/gateway-access: "true", which is how thirdparty publishes the mocks under dev's hostname. QA and prod carry that label too, so the dev listener would admit a route from them if one asked. Nothing in the manifests does.

The split of roles is why the deployer may create HTTPRoutes and has no right over the Gateway or its certificate.

An own CA, trusted explicitly

A public CA can't issue a certificate for a nip.io name of a private address. So platform/gateway.yaml builds a CA with cert-manager in four objects: a self-signed ClusterIssuer, a ten-year CA Certificate eshop-ca, a ClusterIssuer that signs with it, and the Certificate eshop-tls for the three hostnames5. Both keys are ECDSA P-256.

Clients trust the CA, never skip verification. People import the exported CA into their trust store. Automation uses the committed public certificate clusters/eshop-prd1/platform/eshop-ca.crt with curl --cacert.

The catch: a rebuilt cluster makes a new CA. Until eshop-ca.crt is replaced in a merge request, the smoke test, the probe and the watchdog fail certificate verification. The rebuild guide has that as its own step, followed by another run of bootstrap.sh.

Default deny, and every allowed path has both ends

Every eShop namespace starts with the same baseline6:

# eshop-infra/deploy/network-policies/default-deny/default-deny.yaml
kind: NetworkPolicy
metadata:
  name: default-deny
spec:
  podSelector: {}
  policyTypes:
    - Ingress
    - Egress

A second policy, allow-dns, lets every pod reach cluster DNS on port 53. Then each service lists its own connections. A connection needs both ends: the caller's egress and the callee's ingress, in the same merge request.

Diagram of the request path from a client through MetalLB and eShop's Traefik to the services in eshop-dev, the allowed calls to PostgreSQL and the thirdparty mocks with their ports, and blocked paths drawn as dashed red lines

Solid arrows are the paths a NetworkPolicy allows, labelled with the port. Dashed red ones are refused: dev to prod, any service to the internet, and the load generator straight to a service.

Pods May be called by May call
eshop-web Traefik nothing
eshop-api Traefik its PostgreSQL (5432), eshop-node-api (8080), thirdparty-mock (8080)
eshop-node-api Traefik, eshop-api Samba in thirdparty (445)
eshop-sync-master nothing its PostgreSQL (5432), SQL Server in thirdparty (1433)
PostgreSQL eshop-db eshop-api, eshop-sync-master, the operator the Kubernetes API server, its own instances

Inside an environment, callers are selected by pod label with no namespace selector, which means "this policy's own namespace". No rule anywhere names one environment from another, so isolation is a property of the rules, not of good behaviour. The mocks in thirdparty select callers by namespace and pod, and can't open a connection into any environment.

Pitfall: an ipBlock doesn't reach the API server on Cilium

CloudNativePG's initdb job calls the API server. A standard policy allows that on paper: ipBlock 0.0.0.0/0, ports 443 and 6443. Cilium doesn't match an ipBlock against cluster entities such as the API server7, so the job times out and PostgreSQL never starts. One Cilium-specific policy in every overlay opens the path:

# eshop-infra/clusters/eshop-prd1/components/cnpg-cilium/eshop-db-kube-apiserver.yaml
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: eshop-db-kube-apiserver
spec:
  endpointSelector:
    matchLabels:
      cnpg.io/cluster: eshop-db
  egress:
    - toEntities: [kube-apiserver]
      toPorts:
        - ports:
            - port: "6443"
              protocol: TCP
            - port: "443"
              protocol: TCP

Test a new path on the cluster. Don't reason only from the YAML.

Two limits to know. eshop-traefik has no policy of its own, so only the receiving pods' ingress rules stop Traefik. And a policy that selects by pod label trusts whoever can create pods with that label, which is the deployer.

PostgreSQL under an operator, on two storage classes

$ kubectl get storageclass
NAME                       PROVISIONER                                       RECLAIMPOLICY   VOLUMEBINDINGMODE
dkp-object-store           kommander-default-workspace.ceph.rook.io/bucket   Delete          Immediate
nutanix-volume (default)   csi.nutanix.com                                   Delete          WaitForFirstConsumer

nutanix-volume gives disks from the Nutanix CSI driver. dkp-object-store gives buckets in NKP's Ceph; Tempo claims one, capped at 10G, and keeps traces 7 days. Both say Delete: deleting a claim deletes its data.

Each environment declares one CloudNativePG Cluster8, and Flux applies it with the rest:

# eshop-infra/deploy/apps/base/eshop-db/cluster.yaml
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: eshop-db
spec:
  instances: 1
  imageName: ghcr.io/cloudnative-pg/postgresql:18.6-system-trixie@sha256:48a0...
  storage:
    size: 1Gi
  bootstrap:
    initdb:
      database: eshop
      owner: eshop
      secret:
        name: eshop-db-credentials
$ kubectl get clusters.postgresql.cnpg.io -A
NAMESPACE    NAME       AGE     INSTANCES   READY   STATUS                     PRIMARY
eshop-dev    eshop-db   3h49m   1           1       Cluster in healthy state   eshop-db-1
eshop-prod   eshop-db   3h27m   1           1       Cluster in healthy state   eshop-db-1
eshop-qa     eshop-db   3h34m   1           1       Cluster in healthy state   eshop-db-1

The operator turns those lines into a pod, a 1Gi claim, three Services and TLS certificates. The deployer needs one rule for it and no right to create StatefulSets. No overlay changes the size or instance count, so prod's database is exactly as small as dev's.

On a new environment eshop-api restarts three or four times in its first minute. It runs migrations at start and the database isn't up yet. Leave it alone.

Pitfall: the image policy and the operator fight over a tag

That @sha256: in imageName isn't decoration. Without it PostgreSQL restarts in a loop.

policy-controller rewrites an image given by tag into tag plus digest when it admits a pod. CloudNativePG compares the image in its Cluster with the running pod's image, sees a difference it didn't ask for, and replaces the pod. The new pod is rewritten again, without end. The same goes for the operator's own image, which goes into every database pod as an init container.

The guard leaves the webhook nothing to rewrite. The Cluster names PostgreSQL by digest, and bootstrap.sh pins the operator the same way:

helm upgrade --install cloudnative-pg cloudnative-pg --repo https://cloudnative-pg.github.io/charts \
  --version 0.29.1 --namespace cnpg-system --create-namespace --wait --timeout 10m \
  --set-string image.tag=1.30.1@sha256:923c...

A mutating admission webhook and an operator that compares desired with actual state will fight, unless the desired state is already in the form the webhook produces.

The mock Enterprise System is a real SQL Server

The Enterprise System owns Contracts and Payments, and the lab has no real one. ADR 0003, "Mock the Enterprise System with a real SQL Server", accepted about 2 GB of memory and a slow start so that eshop-sync-master meets the same driver, SQL dialect and port 1433 as in production.

To contain that cost, one instance in thirdparty serves all three environments:

  • SQL Server 2022 CU27, Developer edition, image pinned by digest, a 4Gi claim, three databases (enterprise_dev, enterprise_qa, enterprise_prod) and one login per environment that reads and writes only its own.
  • A schema container in the same pod runs init.sh on every start: it creates missing databases, applies the schema and resets every login from the Secret mssql-credentials. The pod shows 2/2 only when the schema is applied.
  • Samba stands in for the organisation's file server for Product photos: one pod, three shares, one account per share.

The network lets all three environments reach the same SQL Server and Samba. What separates them there is credentials.

thirdparty-mock page saying it is test equipment, not a real third party, with links to the SMS mock inbox and the Enterprise System admin, a response delay setting and a list of test ID numbers

The mock's own page under dev's hostname at /thirdparty-mock/. The second link opens the Enterprise System admin, which reads that SQL Server; the test ID numbers' last two digits pick the outcome.

Secrets come from a script, with random values, and nothing is in Git

The Secrets the manifests read are created by bootstrap.sh step 6. No value is in Git, and none passes through GitLab.

# eshop-infra/clusters/eshop-prd1/bootstrap.sh
random() { openssl rand -base64 48 | tr -d '/+=\n' | cut -c1-"${1:-32}"; }
has() { kubectl -n "$1" get secret "$2" >/dev/null 2>&1; }
# create <namespace> <name> <type> <key=value>... : from an env file on a pipe, so no value is on a command line
create() {
  local ns=$1 name=$2 type=$3; shift 3
  if has "$ns" "$name"; then ok "$ns/$name exists (kept)"; return; fi
  kubectl -n "$ns" create secret generic "$name" --type="$type" --from-env-file=<(printf '%s\n' "$@") >/dev/null
  ok "$ns/$name created"
}

Four properties are in those lines:

  • Random. Every value comes from openssl rand.
  • Created only when missing. A re-run prints "exists (kept)" and never changes a password under a running service.
  • Never printed. Values reach kubectl through a file descriptor, not a command line a process list would show.
  • Agreeing pairs read back. An environment's SMB and SQL passwords must equal the thirdparty side, so the script creates that side first, reads it into a variable, and exits if the read is empty.

That last check exists because a failed read placed directly inside the argument would create a Secret with no password and report success.

Diagram of bootstrap.sh step 6 creating mssql-credentials and samba-accounts in thirdparty, copying two passwords into each environment's Secrets, and the smoke test reading only eshop-api-staff

Step 1 creates the thirdparty Secrets, step 2 copies the two passwords that must agree, step 3 creates the environment-only ones. The deploy reads exactly one Secret; the operators make their own.

Each environment gets five Secrets: eshop-db-credentials, eshop-api-auth (the token signing key), eshop-api-staff, eshop-node-api-smb and eshop-sync-master-enterprise. Dev's signing key doesn't validate a prod token.

Staff sign-in card with username and password fields under the eShop back-office header

The Staff sign-in. Both fields come from eshop-api-staff, the one Secret a deploy may read, because the smoke test signs in here.

A missing Secret shows at the rollout, not before

Neither Flux's deployer nor CI can list Secrets, so nothing checks them before an apply. The pod that refers to a missing one waits with CreateContainerConfigError, and the deploy job prints what each container waits for:

# eshop-infra/scripts/ci/deploy-eshop-prd1.sh
diagnose() {
  echo "--- $namespace: containers that are waiting" >&2
  kubectl -n "$namespace" get pods -o json 2>/dev/null | jq -r '.items[] | .metadata.name as $pod
    | ((.status.initContainerStatuses // []) + (.status.containerStatuses // []))[] | select(.state.waiting)
    | "  \($pod)/\(.name): \(.state.waiting.reason): \(.state.waiting.message // "")"' >&2 || true
  echo "A Secret that is missing is a cluster admin's to create: clusters/eshop-prd1/bootstrap.sh" >&2
}

Reading pod status is inside view, so the diagnosis needs no Secret right.

Why no Secret is stored in Git

The alternative is encrypted files in Git, SOPS for example, decrypted and applied by Flux. No ADR records the choice against it. The reasoning has three parts:

  • The deploying identity has only what a deploy uses, and writing Secrets isn't part of that.
  • A script needs no new controller and no new key to guard.
  • A rebuilt cluster gets new random values anyway, so there's nothing to carry over.

One guard keeps it that way: a Kustomize component in every eshop-prd1 overlay deletes any Secret from the render, so none can arrive through Git by accident.

What's traded away is everything Git gives: history, review and recovery. A rebuild restores no Secret and no CA; the script and cert-manager make new ones, and nothing outside the cluster depends on the old values. A lost cluster loses every value.

Rotation is manual: delete the Secret, run the script, restart the pods that read it. For an agreeing pair, both sides go together, thirdparty first.

What production would change

This is a lab, and the repository says so plainly.

Lab Production
three environments in one workload cluster, CPU limits at 109% a separate cluster per environment, or at least for prod, with a capacity plan
one PostgreSQL instance, 1Gi, no backup, reclaim policy Delete several instances, WAL archiving and scheduled base backups to object storage, a tested restore
Secrets exist only in the cluster; no history, no rotation runbook the organisation's secret store with a sync operator, or encrypted files with a key backed up outside the cluster
a one-year read-only token in a CI variable short-lived credentials through an OIDC exchange; a separate deployer identity for prod
nip.io names and a CA whose private key any cluster admin can read real DNS, a certificate from the organisation's CA, a Gateway or certificate per environment
SQL Server Developer edition and Samba as mocks the real Enterprise System and file server; neither pod exists
four chart versions moved by hand watched for security fixes like any other dependency

Two things aren't verified on the cluster: whether eshop-prd1 encrypts Secrets at rest in etcd, and what CloudNativePG does when eshop-db-credentials changes after the database exists. Rotate in dev first.

One more caveat for anyone overriding platform values: an NKP upgrade of kube-prometheus-stack may put defaults back silently. After any NKP upgrade, run bootstrap.sh again and read what it reports.

Summary

A checklist for putting an application on a platform distribution:

  • List what the platform provides and use it. Bring your own piece only where the platform's version doesn't fit, and write down why.
  • Never change a CRD or Helm release the platform owns. Use its override mechanism, and install your own charts with --skip-crds.
  • Check that no platform application owns the CRDs of an operator you install yourself.
  • Give every AppDeployment a clusterSelector, and check the workload cluster, not the console.
  • Put every cluster-wide change in one idempotent script, run by a person, from a machine near the cluster.
  • Split identities by job: one writes from inside the cluster, CI reads, people read without Secrets.
  • Prove each identity with kubectl auth can-i before you hand out its kubeconfig, write checks included.
  • Name every Secret a role may read. Treat get on Secrets with no resourceNames as a finding.
  • Start every namespace from default-deny and add both ends of each connection in one merge request.
  • Test network policies on the real CNI. An ipBlock isn't the API server on Cilium.
  • Pin by digest any image that an operator compares and an admission webhook rewrites.
  • Decide for each store who runs it, what a deleted claim does, and how it's backed up, before you need the answer.
  • For each Secret, know who creates it, who reads it and how it's replaced.

Next: Post 07: Observability: metrics, logs, traces and alerts on NKP's monitoring stack, and how one request shows up in all three signals.


  1. Nutanix, Nutanix Kubernetes Platform (NKP). The administration guides for each NKP release are on the Nutanix Support Portal. ↩

  2. Flux, Kustomization: spec.serviceAccountName names the ServiceAccount impersonated while reconciling. ↩

  3. Kubernetes, Gateway API: GatewayClass, Gateway and HTTPRoute, modelled after organisational roles. ↩

  4. nip.io: wildcard DNS that answers a hostname with the IP address embedded in it. ↩

  5. cert-manager, SelfSigned issuer: bootstrapping a CA issuer from a self-signed one. ↩

  6. Kubernetes, Network Policies: default deny for all ingress and all egress traffic. ↩

  7. Cilium, Network Policy: layer 3 policies, including entities-based rules. ↩

  8. CloudNativePG: the Kubernetes operator for PostgreSQL. ↩

Discussion

Have thoughts on this post? Share them below — questions, corrections, or your own experience are all welcome.