Skip to main content

Overview

Cilium is an eBPF-based open-source cloud-native networking solution that provides high-performance networking, advanced network security policies, and observability for Kubernetes clusters. This series of tutorials covers how to install and use Cilium in TKE clusters.

Article Map

Getting Started

ArticleContentAudience
Installing CiliumEmpty cluster creation, helm installation, verification, rollbackFirst-time users
Cilium Functional TestFunctional testing methods and measured dataAll post-install users
Cilium Performance TestBaseline network performance and cross-scheme comparisonPerformance-focused users

Network Enhancement

ArticleContentApplicable Plans
Using Gateway APICilium built-in Gateway API for traffic routingOverlay only (ipam=multi-pool)
Egress Gateway in PracticeSelect fixed egress IP per policy for external accessAll three plans (Native verified in tests)
Enabling Communication EncryptionWireGuard / IPsec encryption for inter-node Pod trafficWireGuard: all plans (IPsec has limits, see that guide)
Building Multi-Cluster Networks with CiliumClusterMesh to connect services across clustersAll plans (needs cross-cluster connectivity, see guide)

Security Policies

ArticleContent
NetworkPolicy in PracticeCiliumNetworkPolicy introduction with 20+ common patterns

Observability

ArticleContent
Enhanced ObservabilityEnable Hubble Relay / Hubble UI / network flow log audit
Cilium + CLS for Network Flow Log AuditShip Hubble flow logs to CLS for search and analysis

Appendix

ArticleContent
Cilium Network Performance BenchmarkCross-scheme stress test: throughput / RPS / Service scaling / policy overhead
Cilium Tuning for Large ClustersParameter, resource, and BPF map tuning for 200+ node clusters
Verified Node Operating SystemsCompatibility verification results for 8 OS types
sysctlfix and rp_filter Deep DiveWhy both modes disable sysctlfix, the udev override mechanism, and Overlay's DaemonSet compensation
VPC-CNI Native Routing DetailsConfiguration principles of local-router-ipv4, sysctlfix, and Host Routing
Why GR Native Routing Is Not AvailableComplete trial-and-error record and 4 types of issues
Cilium with NodeLocal DNSCacheSelf-built NodeLocal DNS cache for DNS acceleration
Configure IP MasqueradingLet Pods egress via node EIP without NAT gateway
Host Cilium Images via TCRUse internal TCR instead of pulling from Docker Hub

Troubleshooting

ArticleContent
Apiserver Connection Error: operation not permittedCilium bug investigation and root cause analysis
Webhook Connection Timeout in Overlay ModeRoot cause and hostNetwork solution for apiserver-to-webhook timeouts in managed clusters
Cilium Debugging Quick ReferenceCommon debugging commands: cilium status, monitor, hubble observe, BPF maps

Quick Decision Tree

Find the target article based on your needs:

What do you want to do?
├─ Install Cilium
│ ├─ New cluster, first-time install → Installing Cilium
│ ├─ Existing cluster, want to test → Functional Test
│ └─ Care about performance → Performance Test
├─ Configure network capabilities
│ ├─ Expose HTTP/HTTPS services (Ingress alternative) → Gateway API
│ ├─ Pods need outbound internet
│ │ ├─ Already have NAT Gateway → No additional config needed
│ │ ├─ Want to reuse node EIP → Configure IP Masquerade
│ │ └─ Want fixed egress IP → Egress Gateway
│ ├─ Encrypt inter-node traffic → Enable Communication Encryption
│ ├─ Connect multiple clusters → Building Multi-Cluster Networks
│ └─ Accelerate DNS resolution → Nodelocal DNSCache
├─ Write network policies
│ └─ Restrict Pod-to-Pod/egress/ingress access → NetworkPolicy in Practice
├─ Observability
│ ├─ View cluster service topology → Enhanced Observability
│ └─ Audit network flow logs → Cilium + CLS Log Audit
├─ Tuning & Troubleshooting
│ ├─ Large cluster optimization → Large Cluster Tuning Guide
│ ├─ Check OS compatibility → Verified Node Operating Systems
│ ├─ Apiserver connection error → Corresponding troubleshooting article
│ └─ Webhook (cert-manager etc.) connection timeout → Corresponding troubleshooting article
└─ Understand design principles
├─ What is Host Routing → Native Routing Deep Dive
├─ Why configure local-router-ipv4 → Native Routing Deep Dive
└─ Why GR doesn't work → GR Native Not Recommended

Network Modes

Cilium supports two routing modes:

  1. Encapsulation: Wraps network packets in another layer (e.g., vxlan) for forwarding. Good compatibility across various network environments, slightly lower performance.
  2. Native-Routing: Pod IPs are routed directly on the underlying network without Cilium intervention. Better performance, but relies on the underlying network's support for Pod IP routing.

In cloud-managed Kubernetes clusters, including TKE, the VPC underlay network already supports Pod IP routing, eliminating the need for an overlay layer to achieve optimal network performance. Therefore, Native-Routing mode is typically used.

However, if you have the following requirements, you may choose Encapsulation (vxlan overlay) mode:

  • VPC IP resources are scarce and you don't want Pod IPs to consume underlay IPs.
  • Need to manage IDC clusters, replacing TKE's built-in CiliumOverlay network mode.
  • Want to use the latest Cilium version with full feature set (without coexisting with kube-proxy, avoiding degradation of NetworkPolicy and other features).

For more details, refer to the Cilium official documentation: Routing.

This series provides three deployment schemes that have been fully e2e tested:

SchemeCluster Network ModeRouting ModePod IP SourceKey Features
Native Routing (VPC-CNI)VPC-CNINativeVPC subnet IPPods natively recognized by VPC
Overlay (VPC-CNI)VPC-CNIVXLANIndependent CIDRIP decoupled from VPC, full feature set
Overlay (GR)GRVXLANIndependent CIDROnly recommended for existing GR clusters

GR + Native Routing is no longer provided due to compatibility issues. See Why GR Native Routing Deployment Is Not Recommended.

Prerequisites

To install Cilium in a TKE cluster, the following prerequisites must be met:

Companion Tools

This series comes with a one-click installation script cilium.sh that wraps common operations such as installation, testing, and uninstallation:

SubcommandFunction
cilium.sh installAuto-detect cluster environment, interactive guided installation
cilium.sh uninstallUninstall Cilium, restore TKE components
cilium.sh testRun 130+ functional test cases (with China region adaptation)
cilium.sh perfExecute network performance benchmarks (TCP_RR / TCP_STREAM)
cilium.sh enable-hubbleOne-click enable Hubble Relay + UI
cilium.sh enable-egress-gatewayOne-click enable Egress Gateway
cilium.sh install-localdnsOne-click install NodeLocal DNSCache (coexists with Cilium)

Key Capabilities

After installing Cilium in TKE, it can replace or enhance the following TKE native network components:

CapabilityTKE NativeCilium Replacement/Enhancement
kube-proxyInstalled by defaultkubeProxyReplacement (complete replacement)
NetworkPolicyL7/DNS not supportedCiliumNetworkPolicy (supports L7 / FQDN)
ObservabilityNoneHubble (service topology + network flow logs)
Egress ControlRequires additional configEgress Gateway (per-policy egress IP selection)
EncryptionNoneWireGuard / IPsec transparent encryption
IP Masqueradeip-masq-agentBuilt-in BPF ip-masq-agent (better performance)
Multi-Cluster NetworkNoneClusterMesh (cross-cluster Service access)