Kube-OVN Overlay Network Supports IPsec Encryption
This document provides a detailed guide on enabling and disabling IPsec encrypted tunnel traffic in the Kube-OVN Overlay network. Since OVN tunnel traffic is transmitted through physical routers and switches, which may be located in untrusted public networks or at risk of attacks, enabling IPsec encryption can effectively prevent traffic data from being monitored and tampered with.
TOC
Terminology
Notes
-
Enabling IPsec may cause a few seconds of network interruption.
-
If the kernel version is 3.10.0-1160.el7.x86_64, enabling the IPsec feature of Kube-OVN may encounter compatibility issues.
Prerequisites
Please execute the following command to check whether the current operating system kernel supports IPsec-related modules. If the output shows that all XFRM-related modules are y or m, it indicates support for IPsec.
Output:
Procedure
Note: Unless otherwise specified, the following commands must be executed in the CLI tool on the cluster Master node.
Enable IPsec
-
Modify the configuration file of kube-ovn-controller.
-
Execute the following command to edit the YAML configuration file of kube-ovn-controller.
-
Modify the specified fields according to the following instructions.
Field explanations:
- spec.template.spec.containers[0].args: Add
- --enable-ovn-ipsec=trueunder this field. - spec.template.spec.containers[0].securityContext.runAsUser: Change the value of this field to 0.
- spec.template.spec.containers[0].args: Add
-
Save the changes.
-
-
Modify the kube-ovn-cni configuration file.
-
Execute the following command to edit the YAML configuration file of kube-ovn-cni.
-
Modify the specified fields according to the following instructions.
Field explanations:
- spec.template.spec.containers[0].args: Add
- --enable-ovn-ipsec=trueunder this field. - spec.template.spec.containers[0].volumeMounts: Add the mount path and mount the volume named ovs-ipsec-keys to the container.
- spec.template.spec.volumes: Add a volume named ovs-ipsec-keys of type hostPath under this field.
- spec.template.spec.containers[0].args: Add
-
Save the changes.
-
-
Verify whether the feature has been successfully enabled.
-
Execute the following command to enter the kube-ovn-cni Pod.
-
Execute the following command to check the number of Security Associations connections. If there are (number of nodes - 1) up, it indicates a successful enablement.
Output:
-
Disable IPsec
-
Modify the configuration file of kube-ovn-controller.
-
Execute the following command to edit the YAML configuration file of kube-ovn-controller.
-
Modify the specified fields according to the following instructions.
Field explanations:
- spec.template.spec.containers[0].args: Change the value of this field
enable-ovn-ipsecto false. - spec.template.spec.containers[0].securityContext.runAsUser: Change the value of this field to 65534.
- spec.template.spec.containers[0].args: Change the value of this field
-
Save the changes.
-
-
Modify the kube-ovn-cni configuration file.
-
Execute the following command to edit the YAML configuration file of kube-ovn-cni.
-
Modify the specified fields according to the following instructions.
-
Configuration before modification
Field explanations:
- spec.template.spec.containers[0].args: Change the value of this field
enable-ovn-ipsecto false. - spec.template.spec.containers[0].volumeMounts: Remove the mount path named ovs-ipsec-keys under this field.
- spec.template.spec.volumes: Remove the volume named ovs-ipsec-keys, type hostPath under this field.
- spec.template.spec.containers[0].args: Change the value of this field
-
Configuration after modification
-
-
Save the changes.
-
-
Verify whether the feature has been successfully disabled.
-
Execute the following command to enter the kube-ovn-cni Pod.
-
Execute the following command to check the connection status. If there is no output, it indicates successful disabling.
-