Guardrails

Security, reliability, and operational guardrails on the ayedo SDP: core principles for containers, resources, networking, and high availability.

Guardrails

Guardrails define binding architectural and operational guidelines for applications running on the ayedo Software Delivery Platform (SDP). They help development teams eliminate security risks early, prevent downtime during maintenance, and share cluster resources fairly.

Context: Policies and Runtime Security

Depending on the setup and compliance requirements of your SDP instance, Kyverno (Policy-as-Code / Admission Control) and Falco (Runtime Security) may be active as standard cluster components:

  • Audit mode: Deviations are logged and surfaced in reports or dashboards without blocking deployments.
  • Enforce mode: Non-compliant manifests are rejected directly at the Kubernetes API during deployment.

Regardless of which rules are technically enforced in your specific cluster, all production workloads should follow the guardrails below across the three categories: Security, Reliability, and Operational.

1. Security Guardrails

Unprivileged Containers (Non-Root)

Application processes must not run as root (UID 0) and must not request elevated Linux capabilities or privileged container permissions. Define a non-root user directly in your Dockerfile (USER 1000) and set a restrictive securityContext in the pod manifest:

podSecurityContext:
  runAsNonRoot: true
  runAsUser: 1000
  runAsGroup: 1000
  fsGroup: 1000
securityContext:
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities:
    drop:
      - ALL

Unique, Immutable Image Tags

Avoid :latest or untagged image references. Always use unique, immutable version tags (Semantic Versioning such as :1.4.2, Git commit SHAs, or image digests) so deployments remain reproducible and traceable.

Trusted Container Registries

Pull production container images from approved registries — typically your own Harbor instance (registry.acme.corp). There, images are centrally versioned and automatically scanned for known vulnerabilities (CVEs). External base or third-party images should be mirrored into Harbor before production use.

Network Segmentation with NetworkPolicies

Without a NetworkPolicy, pods within a cluster can generally communicate freely with each other. Implement a Default Deny stance for every production namespace and explicitly allow only required traffic paths (for example inbound from the ingress/gateway namespace, and outbound to databases, DNS, and required external APIs). Cilium enforces these rules efficiently at the eBPF layer.

No Secrets in Git Repositories

Credentials, API keys, and certificates never belong in plaintext in Git or container images. Manage secrets centrally in OpenBao and synchronize them into Kubernetes Secrets via the External Secrets Operator (ESO).

2. Reliability Guardrails

Resource Requests and Limits

Every container should define realistic resources.requests and resources.limits for CPU and memory:

resources:
  requests:
    cpu: 100m
    memory: 256Mi
  limits:
    cpu: 500m
    memory: 512Mi

Only with properly defined requests can the Kubernetes scheduler place pods effectively across nodes and allow a HorizontalPodAutoscaler to operate reliably (see Capacity Management).

Health Checks (Probes)

For all long-running services, define at least a Readiness Probe (controls inclusion in the Kubernetes Service) and a Liveness Probe (detects hung processes). For applications with longer startup times, add a Startup Probe as well.

Multiple Replicas, Topology Spread, and PodDisruptionBudgets

For highly available production workloads, combine three building blocks:

  • At least two replicas: Prevents outages during single pod restarts or node maintenance.
  • Topology spread / anti-affinity: Distributes replicas across separate nodes (or availability zones).
  • PodDisruptionBudget (PDB): Prevents all replicas from being terminated simultaneously during planned cluster maintenance (see Maintenance and Upgrades).

Always Run Workloads via Controllers

Never deploy standalone pods (kind: Pod); always use an appropriate Kubernetes controller (Deployment, StatefulSet, DaemonSet, Job, or CronJob) so self-healing and controlled updates work properly.

3. Operational Guardrails

Ingress / Gateway API Instead of Direct LoadBalancer Services

Expose HTTP(S) applications via Service type: ClusterIP combined with the platform ingress (NGINX Ingress) or the Kubernetes Gateway API (Envoy Gateway). This gives you centralized TLS automation (cert-manager), consistent routing, and optional WAF protection (see Ingress & Edge).

Persistent Storage Instead of emptyDir for Application Data

Use emptyDir strictly for ephemeral caches or temporary working files (such as /tmp when readOnlyRootFilesystem: true). Persistent application data belongs in a PersistentVolumeClaim (see Platform Storage), a managed database, or Object Storage (S3).

Clean Up Completed Jobs (ttlSecondsAfterFinished)

Configure one-off Jobs (such as database migrations) with spec.ttlSecondsAfterFinished so finished job objects and pods are cleaned up automatically instead of accumulating indefinitely in the namespace.

Handling Policy Checks and Exceptions

If an admission policy is active in your SDP environment and rejects a deployment:

  1. Inspect the exact error message in kubectl, Argo CD, or your CI/CD pipeline.
  2. Fix the root cause directly in the container image or manifest whenever possible (e.g., non-root user, fixed version tag, resource requests/limits).
  3. If a justified technical special case requires an exception (for example legacy software), coordinate a targeted, time-bound, and narrowly scoped exception with your platform administrators and document it.

Further Reading