cilium-mesh

by Helm

Helm chartv1.0.2

Cilium service mesh configuration

About this chart

Cilium Mesh Helm Chart

Helm chart for configuring Cilium service mesh and network policies in Kubernetes. It manages three Cilium CRDs — CiliumEnvoyConfig, CiliumClusterwideNetworkPolicy, and CiliumNetworkPolicy — providing a declarative, values-driven way to configure Envoy proxy behavior and L7 network policies across your cluster.

Who Is This For?

Platform engineers and Kubernetes operators who run Cilium as their CNI and want a reusable, standardized way to:

  • Configure Envoy-based load balancing, circuit breaking, retries, and timeouts for services
  • Define cluster-wide or namespace-scoped L7 network policies with CIDR and HTTP rules
  • Embed Cilium mesh configuration into existing Helm-based deployment workflows

Assumption: Cilium is already installed and configured in your cluster with Envoy proxy support enabled. This chart does not install Cilium itself.

Core Concepts

What This Chart Does

Cilium's service mesh capabilities are powerful but verbose to configure. This chart abstracts the underlying CRD manifests behind a clean values.yaml interface:

  • CiliumEnvoyConfig — Generates full Envoy listener, cluster, and route configurations from a handful of values (load balancer policy, connection pool, outlier detection, timeouts, retries).
  • CiliumClusterwideNetworkPolicy — Creates L7-aware ingress policies that apply across all namespaces, filtering by CIDR and HTTP attributes (host, method, path).
  • CiliumNetworkPolicy — Creates namespace-scoped L7 ingress policies with pod label selectors.

How to Use

Add cilium-mesh as a dependency in your application's Chart.yaml:

dependencies:
  - name: cilium-mesh
    version: 1.0.2
    condition: cilium-mesh.enabled
    repository: https://charts.softonic.io

Then pass values under the cilium-mesh key in your application's values.yaml:

cilium-mesh:
  enabled: true
  CiliumServiceMesh:
    my-api:
      serviceName: my-api
      port: 8080
      namespace: production
      loadBalancerPolicy: ROUND_ROBIN
      timeout: "1s"
      retries: 3

Pull the dependency and install:

helm dependency update
helm template my-release . -f values.yaml
helm install my-release . -f values.yaml -n my-namespace

Tip: Set cilium-mesh.enabled: false to disable the dependency entirely without removing it from Chart.yaml.

Configuration Reference

CiliumServiceMesh

Configures Envoy proxy resources. Each key becomes a separate CiliumEnvoyConfig resource.

ParameterDescriptionDefaultRequired
serviceNameKubernetes service name—Yes
portService port—No
namespaceKubernetes namespaceRelease namespaceNo
loadBalancerPolicyEnvoy LB algorithm (LEAST_REQUEST, ROUND_ROBIN, RANDOM, etc.)LEAST_REQUESTNo
timeoutRequest timeout (Envoy duration format)"0.600s"No
retriesNumber of retry attempts3No
retryOnComma-separated retry conditions"gateway-error,connect-failure,reset,refused-stream"No
connectionPool.maxConnectionsMax concurrent connections (circuit breaker)1024No
connectionPool.maxPendingRequestsMax queued requests1024No
connectionPool.maxRequestsPerConnectionMax requests per connection before closing1No
connectionPool.idleTimeoutIdle connection timeout"3s"No
outlierDetection.intervalHealth check interval"1s"No
outlierDetection.baseEjectionTimeBase duration for ejecting unhealthy hosts"10s"No
outlierDetection.maxEjectionPercentMax percentage of hosts that can be ejected20No
outlierDetection.minHealthPercentMinimum healthy host percentage (panic threshold)70No

CiliumClusterwideNetworkPolicy

Defines cluster-wide L7 network policies. Each key becomes a separate CiliumClusterwideNetworkPolicy resource targeting reserved:ingress endpoints on port 443/TCP.

ParameterDescriptionDefaultRequired
fromCIDRList of allowed source CIDR blocks—Yes
httprulesList of HTTP match rules—No
httprules[].hostHost header regex—Yes (if httprules used)
httprules[].methodHTTP method (GET, POST, etc.)—No
httprules[].pathURL path to match—No

CiliumNetworkPolicy

Defines namespace-scoped L7 network policies with pod label selectors.

ParameterDescriptionDefaultRequired
labelsPod selector labels (matchLabels)—Yes
portAllowed destination port—Yes
fromCIDRList of allowed source CIDR blocks—Yes
httprulesList of HTTP match rules—No
httprules[].hostHost header regex—Yes (if httprules used)
httprules[].methodHTTP method—No
httprules[].pathURL path to match—No

Examples

Example 1: Minimal Service Mesh Setup

Configure Envoy load balancing for a single service with all defaults:

# values.yaml
cilium-mesh:
  enabled: true
  CiliumServiceMesh:
    my-api:
      serviceName: my-api
      port: 8080
      namespace: production

This creates a CiliumEnvoyConfig with:

  • LEAST_REQUEST load balancing
  • 600ms timeout
  • 3 retries on gateway errors
  • Default connection pool (1024 max connections)

Example 2: Advanced Multi-Service Setup with Network Policies

Full configuration with circuit breaking, outlier detection, and L7 network policies:

# values.yaml
cilium-mesh:
  enabled: true

  # --- Envoy Proxy Configuration ---
  CiliumServiceMesh:
    frontend:
      serviceName: frontend-svc
      port: 3000
      namespace: web
      loadBalancerPolicy: ROUND_ROBIN
      timeout: "2s"
      retries: 5
      retryOn: "5xx,connect-failure,reset"
      connectionPool:
        maxConnections: 2048
        maxPendingRequests: 512
        maxRequestsPerConnection: 10
        idleTimeout: "5s"
      outlierDetection:
        interval: 5s
        baseEjectionTime: 30s
        maxEjectionPercent: 10
        minHealthPercent: 80

    backend-api:
      serviceName: backend-api
      port: 8080
      namespace: api
      loadBalancerPolicy: LEAST_REQUEST
      timeout: "5s"
      retries: 3

  # --- Cluster-Wide Network Policies ---
  CiliumClusterwideNetworkPolicy:
    allow-monitoring:
      fromCIDR:
        - 10.0.0.0/8
      httprules:
        - host: "^monitoring\\.example\\.com$"
          method: "GET"
          path: "/healthz"
        - host: "^monitoring\\.example\\.com$"
          method: "GET"
          path: "/metrics"

    allow-partner-api:
      fromCIDR:
        - 203.0.113.0/24
        - 198.51.100.0/24
      httprules:
        - host: "^api\\.example\\.com$"
          method: "POST"
          path: "/v1/webhook"

  # --- Namespace-Scoped Network Policies ---
  CiliumNetworkPolicy:
    allow-frontend-ingress:
      labels:
        app: frontend
        tier: web
      port: 3000
      fromCIDR:
        - 10.0.0.0/8
      httprules:
        - host: "^app\\.example\\.com$"

Best Practices

Naming Conventions

  • Use descriptive keys in CiliumServiceMesh that match your service names for clarity.
  • Policy names in CiliumClusterwideNetworkPolicy and CiliumNetworkPolicy should describe what they allow (e.g., allow-monitoring, allow-partner-webhook).

Security

  • Always use explicit CIDR lists in CiliumClusterwideNetworkPolicy — avoid 0.0.0.0/0 unless you intentionally want to allow all traffic.
  • Use CiliumNetworkPolicy (namespace-scoped) when policies should only apply to specific pods, keeping blast radius small.
  • Always use regex anchors (^...$) in host fields to prevent partial matches.

Resilience Tuning

  • Start with conservative outlierDetection settings (low maxEjectionPercent, high minHealthPercent) and loosen as you gain confidence.
  • Set maxRequestsPerConnection: 1 for HTTP/1.1 services to avoid head-of-line blocking.
  • Keep retryOn conditions specific — avoid retrying on non-idempotent failures.

Versioning

  • The root chart (v1.0.2) and helm/ chart (v0.1.3) are versioned independently. Pin the version when using as a dependency.
  • When upgrading, always run helm template to diff rendered manifests before applying.

Troubleshooting

No Resources Created

Symptom: helm template produces empty output.

Cause: All top-level value maps (CiliumServiceMesh, CiliumClusterwideNetworkPolicy, CiliumNetworkPolicy) default to {}. Templates only render when entries are present.

Fix: Ensure you are passing a values file with at least one entry:

helm template my-release . -f my-values.yaml

CiliumEnvoyConfig Not Routing Traffic

Symptom: Envoy config is created but traffic is not being routed.

Possible causes:

  • serviceName does not match the actual Kubernetes service name.
  • namespace is wrong or omitted (defaults to release namespace).
  • port does not match the service's exposed port.
  • Cilium Envoy proxy is not enabled in your Cilium installation.

Debug:

# Verify the CiliumEnvoyConfig was created
kubectl get ciliumenvoyconfig -A

# Check Cilium agent logs for Envoy errors
kubectl -n kube-system logs -l k8s-app=cilium | grep -i envoy

Network Policy Not Allowing Expected Traffic

Symptom: Requests from allowed CIDRs are being blocked.

Possible causes:

  • CIDR notation is incorrect (e.g., missing /32 for single IPs).
  • host regex does not match the actual Host header sent by clients.
  • The reserved:ingress endpoint selector (cluster-wide policies) requires Cilium's ingress controller to be configured.
  • For CiliumNetworkPolicy, pod labels do not match any running pods.

Debug:

# Check policy status
kubectl get ciliumclusterwidenetworkpolicy
kubectl get ciliumnetworkpolicy -A

# Verify policy is applied to endpoints
kubectl get ciliumendpoint -A

# Monitor policy drops
hubble observe --verdict DROPPED

Deploy cilium-mesh with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cilium-mesh on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcilium-mesh is pinned at v1.0.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply