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 Test | Functional testing methods and measured data | All post-install users | | Cilium Performance Test| Baseline network performance and cross-scheme comparison | Performance-focused users |

Network Enhancement

ArticleContentPrerequisites

| Egress Gateway in Practice | Select fixed egress IP per policy for external access | Cilium installed | | Enabling Communication Encryption | WireGuard / IPsec encryption for inter-node Pod traffic | Cilium installed | | Building Multi-Cluster Networks with Cilium | Cluster Mesh to connect services across clusters | Cilium installed |

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 Tuning for Large ClustersParameter, resource, and BPF map tuning for 200+ node clusters
Verified Node Operating SystemsCompatibility verification results for 8 OS types
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
Cilium Debugging Tipscilium status, monitor, and other common commands

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
│ ├─ 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
└─ Understand design principles
├─ What is Host Routing → Host Routing Appendix
├─ Why configure local-router-ipv4 → Corresponding appendix
└─ 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 NetworkNoneCluster Mesh (cross-cluster Service access)