Calico Network Supports WireGuard Encryption
Calico supports WireGuard encryption for both IPv4 and IPv6 traffic, which can be independently enabled via parameters in the FelixConfiguration resource.
TOC
Installation Status
Default Installation
Not Installed by Default
Terminology
Notes
-
When using the Calico network plugin, ensure that the
natOutgoingparameter is set totrueto support WireGuard encryption. By default, this parameter is correctly configured for the Calico subnet when creating the cluster, requiring no additional configuration. -
WireGuard supports encryption for both IPv4 and IPv6 traffic; if you need to encrypt both types of traffic, configuration must be done separately. For detailed parameter configuration, refer to the Felix Configuration Documentation, configuring both
wireguardEnabledandwireguardEnabledV6parameters. -
If WireGuard is not installed by default, refer to the WireGuard Installation Guide for manual installation, although there may be cases where manual installation of the WireGuard module fails.
-
Traffic between containers across nodes will be encrypted, including network traffic from one host to another; however, communication between Pods on the same node and traffic between a Pod and its host node will not be encrypted.
Prerequisites
- WireGuard must be installed on all nodes in the cluster beforehand. For details, refer to the WireGuard Installation Documentation. Nodes without WireGuard installed do not support encryption.
Procedure
-
Enable or disable IPv4 and IPv6 encryption.
Note: The following commands must be executed in the CLI tool on the Master node where the node resides.
-
Enable IPv4 encryption only
-
Enable IPv6 encryption only
-
Enable both IPv4 and IPv6 encryption
-
Disable both IPv4 and IPv6 encryption
-
Method 1: Execute the command in the CLI tool to disable encryption.
-
Method 2: Modify the felixconfiguration configuration file to disable encryption.
-
Execute the following command to open the felixconfiguration configuration file.
-
Set
wireguardEnabledandwireguardEnabledV6parameters to false to disable WireGuard encryption.
-
-
-
-
After completing the Calico WireGuard encryption configuration, execute the following command to confirm the WireGuard encryption status. If both IPv4 and IPv6 encryption are enabled, the presence of
wireguardPublicKeyorwireguardPublicKeyV6under theStatusfield indicates successful activation; if both IPv4 and IPv6 encryption are disabled, these fields will not containwireguardPublicKeyorwireguardPublicKeyV6, indicating successful deactivation.Output:
Result Verification
This document uses IPv4 traffic verification as an example; IPv6 traffic verification is similar to IPv4 and will not be repeated here.
IPv4 Traffic Verification
-
After configuring WireGuard encryption, check the routing information, where traffic between nodes preferentially uses the wireguard.cali interface for message forwarding.
-
Capture packets on the node to observe cross-node traffic.
-
Testing shows that IPv4 type traffic is forwarded via the wireguard.cali interface.