Network Policy
The platform now provides two different UIs for Network Policies. The old one is maintained for compatibility reasons, while the new one is more flexible and provides a native YAML editor. We recommend using the new version.
Please contact the platform administrator to enable the network-policy-next feature gate to access the new UI.
NetworkPolicy is a namespace-scoped Kubernetes resource and implemented by CNI plugins. Through network policies, you can control network traffic of Pods, achieving network isolation and reducing the risk of attacks.
By default, all Pods can communicate freely, allowing ingress and egress traffic from any source. When a NetworkPolicy is applied, the targeted Pods will only accept traffic that matches the spec.
Network policies only apply to container traffic. They don't affect Pods running in hostNetwork mode.
Example NetworkPolicy:
fromand 'to' peer supportnamespaceSelector,podSelector, 'ipBlock'
TOC
Creating NetworkPolicy by using the web console
-
Enter Container Platform.
-
In the left navigation bar, click Network > Network Policies.
-
Click Create Network Policy.
-
Refer to the following instructions to complete the relevant configuration.
- Click Create.
Creating NetworkPolicy by using the CLI
Reference
If you want more details, check out the official docs on Network Policies.