Cilium

From paulpas/agent-skill-router · View interactive version

Cilium is an AI agent skill from the GitHub repository paulpas/agent-skill-router. "Cilium in Cloud Native Network - cloud native architecture, patterns" pitfalls, and best practices

How to use this skill

Skill file

# Cilium in Cloud-Native Engineering

Category: network

Status: Active

Stars: 24,186

Last Updated: 2026-04-22

Primary Language: Go

Documentation: https://github.com/cilium/cilium


Purpose and Use Cases

Cilium is a cloud-native project that provides network functionality for modern distributed systems.

What Problem Does It Solve?

Cilium addresses the challenges of network in cloud-native environments, enabling teams to implement network features without embedding them in application code.

When to Use This Project

Use cilium when you need network capabilities in your Kubernetes or cloud-native infrastructure. It's ideal when you require network with minimal application code changes.

Key Use Cases


Architecture Design Patterns

Core Components

Component Interactions

  1. Client → Core: Request routing
  2. Core → Storage: Configuration persistence
  3. Controller → Agents: Command distribution
  4. Agents → Controller: Status reporting
  5. Storage → Controllers: Configuration sync

Data Flow Patterns

  1. Request Flow: Client → Core → Backend
  2. Configuration Flow: API → Storage → Nodes
  3. State Flow: Nodes → Control Plane → Dashboard
  4. Telemetry Flow: Data → Collector → Storage

Design Principles


Integration Approaches

Integration with Other CNCF Projects

API Patterns

Configuration Patterns

Extension Mechanisms


Common Pitfalls and How to Avoid Them

Misconfigurations

Performance Issues

Operational Challenges

Security Pitfalls


Coding Practices

Idiomatic Configuration

API Usage Patterns

Observability Best Practices

Testing Strategies

Development Workflow


Fundamentals

Essential Concepts

Terminology Glossary

Data Models and Types

Lifecycle Management

State Management


Scaling and Deployment Patterns

Horizontal Scaling

High Availability

Production Deployments

Upgrade Strategies

Resource Management


Additional Resources


Examples

Enable Network Policy

# Enable Cilium with network policy enforcement
helm install cilium cilium/cilium --namespace kube-system   --set networkPolicy.enabled=true   --set hubble.relay.enabled=true   --set hubble.ui.enabled=true

# Create network policy
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-liveness-probes
spec:
  endpointSelector:
    matchLabels:
      app: frontend
  ingress:
    - fromEntities:
        - cluster

Service Mesh with L7 Policies

# Enable Cilium service mesh
helm install cilium cilium/cilium --namespace kube-system   --set hubble.relay.enabled=true   --set hubble.ui.enabled=true   --set config.enabled=true

# L7 policy for HTTP traffic
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: frontend-to-backend
spec:
  endpointSelector:
    matchLabels:
      app: backend
  ingress:
    - fromEndpoints:
        - matchLabels:
            app: frontend
      toPorts:
        - ports:
            - port: "80"
              protocol: TCP
          rules:
            http:
              - method: "GET"
                path: "/api/.*"

Monitor with Hubble

# Hubble metrics configuration
helm install cilium cilium/cilium --namespace kube-system   --set hubble.metrics.enabled="{dns,drop,tcp,flow,port-distribution,httpV2}"

# Query metrics
kubectl exec -n kube-system <hubble-relay-pod> -- hubble observe --last 100

# Hubble UI access
kubectl port-forward -n hubble-ui svc/hubble-ui 12000:80

Troubleshooting

Cilium pods in CrashLoopBackOff

Cause: Kernel version incompatibility or resource constraints

Solution:

# Check kernel version requirements
# Cilium requires Linux kernel 4.9.17+ or 5.8+

# Check logs
kubectl logs -n kube-system <cilium-pod>

# Disable bpf masquerade if IP masquerade conflicts
helm install cilium cilium/cilium --set bpf.masquerade=false

Network policies not being enforced

Cause: Cilium not installed with network policy support

Solution:

# Verify Cilium is managing the cluster
kubectl get nodes -l alpha.cilium.io/ingress-gateway-ip-alloc

# Enable network policy
kubectl -n kube-system patch daemonset cilium --type=json   -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--network-policy"}]'

# Restart Cilium pods
kubectl -n kube-system delete pods -l k8s-app=cilium

Hubble relay connection failures

Cause: Hubble relay not properly configured or DNS issues

Solution:

# Enable Hubble relay
helm install cilium cilium/cilium --set hubble.relay.enabled=true

# Check relay status
kubectl -n kube-system get pods -l app.kubernetes.io/name=hubble-relay

# Restart relay
kubectl -n kube-system delete pods -l app.kubernetes.io/name=hubble-relay

L7 policy not matching traffic

Cause: Incorrect HTTP rule specification or L7 parser issues

Solution:

# Verify HTTP parsing
cilium status --verbose | grep -A5 "HTTP"

# Use correct HTTP rules format
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: http-policy
spec:
  endpointSelector:
    matchLabels:
      app: backend
  ingress:
    - fromEndpoints:
        - matchLabels:
            app: frontend
      toPorts:
        - ports:
            - port: "80"
              protocol: TCP
          rules:
            http:
              - method: "GET"
              - path: "/api/v1/.*"

IP allocation conflicts

Cause: Overlapping IP ranges with other CNI plugins

Solution:

# Configure unique IP ranges
helm install cilium cilium/cilium --set ipam.mode=cilium --set clusterPoolIPv4PodCIDR=10.0.0.0/8

# Or use AWS VPC CNI integration
helm install cilium cilium/cilium   --set kubeProxyReplacement=partial   --set k8sServiceHost=<api-server-ip>   --set k8sServicePort=<api-server-port>

Content generated automatically. Verify against official documentation before production use.

Troubleshooting

Cilium pods not starting or crashing

Cause: BPF filesystem not mounted, kernel version incompatible, or configuration errors

Solution: Verify BPF filesystem mounted at /sys/fs/bpf, check kernel version requirements, validate Cilium configuration, and examine pod logs for specific errors.

Network policies not being enforced

Cause: Cilium not installed in namespace, wrong policy type, or policy selector mismatch

Solution: Verify Cilium is installed in namespace, check policy type (CiliumNetworkPolicy vs NetworkPolicy), ensure pod selectors match target pods, and run cilium policy get.

Service load balancing not working

Cause: BPF masquerade not enabled, Cilium not watching correct endpoints, or kube-proxy conflicts

Solution: Enable BPF masquerade in Cilium config, ensure Cilium has proper RBAC permissions, verify Cilium is managing endpoints with cilium service list, and check for kube-proxy interference.

High memory usage by Cilium

Cause: Large number of endpoints, complex policies, or memory leaks

Solution: Check endpoint count with cilium endpoint list, optimize policies for fewer rules, monitor memory usage with cilium status, and consider upgrading to newer Cilium versions.

Connectivity issues between pods in different nodes

Cause: BGP not configured correctly, tunnel not working, or firewall blocking overlay traffic

Solution: Verify BGP peer configuration with cilium bpg peer status, check tunnel status with cilium status, verify firewall allows overlay traffic, and test direct pod-to-pod connectivity.


When to Use

Use this skill when:


Core Workflow

  1. Assess Requirements — Understand the use case, scale, integration needs, and existing infrastructure. Checkpoint: Document requirements, constraints, and success criteria.
  1. Design Architecture — Plan component interactions, data flow, and deployment strategy using cloud-native best practices. Checkpoint: Verify the architecture addresses all requirements and follows CNCF conventions.
  1. Implement & Configure — Create manifests, configurations, and deployment scripts. Include resource limits, health checks, and observability hooks. Checkpoint: Validate all YAML against schema and test in a staging environment.
  1. Deploy & Monitor — Apply manifests to the cluster, verify component health, and confirm observability is working. Checkpoint: Confirm all pods/services are running, probes passing, and metrics/alerts configured.

Constraints

MUST DO

MUST NOT DO

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.