-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Added Custom Ingress Network Policy docs #1430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d066aef
6f05782
83144e3
4124cf0
58ffb0d
e68a47f
7ae676f
a478ba8
b73d273
8ece323
43923f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| title: Network policy | ||
| sidebar_label: networkPolicy | ||
|
Check failure on line 3 in vcluster/configure/vcluster-yaml/policies/network-policy.mdx
|
||
| sidebar_position: 1 | ||
| description: Configure network policies to isolate virtual cluster workloads and implement project-scoped network boundaries. | ||
| sidebar_class_name: host-nodes | ||
|
|
@@ -44,24 +44,50 @@ | |
| enabled: true | ||
| ``` | ||
|
|
||
| #### Custom egress rules {#custom-egress} | ||
|
|
||
| Control outbound traffic with specific CIDR blocks: | ||
|
|
||
| #### Custom ingress and egress rules {#custom-rules} | ||
| Control inbound and outbound traffic with specific ports and IP addresses for vCluster control plane and workloads: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a prerequisite warning about CNI support? In the isolated workloads doc there's a warning that network policies require a CNI that supports NetworkPolicy enforcement - would be helpful to call that out here too.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens when this is disabled (the default)? It would help users to know that without network policies, vCluster pods can communicate freely with all pods on the host cluster.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a section showing the actual NetworkPolicy resources that get created when this is enabled? Users would benefit from seeing the default YAML (like |
||
| ```yaml title="vcluster.yaml" | ||
| policies: | ||
| networkPolicy: | ||
| enabled: true | ||
| outgoingConnections: | ||
| ipBlock: | ||
| cidr: 0.0.0.0/0 | ||
| except: | ||
| - 169.254.0.0/16 # AWS metadata service | ||
| - 10.0.0.0/8 # Private network ranges | ||
| - 172.16.0.0/12 | ||
| - 192.168.0.0/16 | ||
|
|
||
| workload: | ||
| ingress: | ||
| # Allow ingress from anywhere to specific ports | ||
| - ports: | ||
| - port: 6060 | ||
| - port: 444 | ||
|
|
||
| egress: | ||
| # Allow egress to a specific address and port | ||
| - to: | ||
| - ipBlock: | ||
| cidr: 172.19.10.23/32 | ||
| ports: | ||
| - port: 7777 | ||
| protocol: TCP | ||
|
|
||
| publicEgress: | ||
| # Disable convenience common public egress rule. | ||
| enabled: false | ||
|
|
||
| controlPlane: | ||
| ingress: | ||
| # Allow ingress traffic from anywhere to the virtual cluster control plane api | ||
| - ports: | ||
| - port: 8443 | ||
|
|
||
| egress: | ||
| # Allow egress traffic to a specific address | ||
| - to: | ||
| - ipBlock: | ||
| cidr: 172.19.10.23/32 | ||
| ``` | ||
|
|
||
| :::note | ||
| `ingress` and `egress` config sections accept the same content type as [PodNetworkPolicy](https://kubernetes.io/docs/concepts/services-networking/network-policies/#podnetworkpolicy-resource) | ||
|
Check warning on line 88 in vcluster/configure/vcluster-yaml/policies/network-policy.mdx
|
||
| ::: | ||
|
|
||
| #### Add custom labels {#custom-labels} | ||
cbalan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Apply labels to generated NetworkPolicies for easier management: | ||
|
|
@@ -114,6 +140,59 @@ | |
| - Allows communication within the same project | ||
| - Enforces network boundaries for CI/CD pipelines | ||
|
|
||
| ## Migration from v0.30 config {#migration} | ||
| `workload` and `controlPlane` configuration sections are introduced to allow defining additional ingress/egress rules for the specific components. | ||
|
|
||
| <div style={{ width: '50%', float: 'left', padding: '5px'}}> | ||
| ```yaml title="vcluster.yaml (v0.30 and earlier)" | ||
| policies: | ||
| networkPolicy: | ||
| enabled: true | ||
|
|
||
| extraControlPlaneRules: | ||
| - ports: | ||
| - port: 8443 | ||
|
|
||
|
|
||
| extraWorkloadRules: | ||
| - ports: | ||
| - port: 6060 | ||
|
|
||
|
|
||
| outgoingConnections: | ||
| ipBlock: | ||
| cidr: 172.19.10.23/32 | ||
| ``` | ||
| </div> | ||
|
|
||
| <div style={{ width: '50%', float: 'right', padding: '5px' }}> | ||
| ```yaml title="vcluster.yaml (v0.31)" | ||
| policies: | ||
| networkPolicy: | ||
| enabled: true | ||
|
|
||
| controlPlane: | ||
| egress: | ||
| - ports: | ||
| - port: 8443 | ||
|
|
||
| workload: | ||
| egress: | ||
| - ports: | ||
| - port: 6060 | ||
|
|
||
| publicEgress: | ||
| cidr: 172.19.10.23/32 | ||
|
|
||
| ``` | ||
| </div> | ||
|
|
||
| ## Config reference | ||
|
|
||
| | Deprecated Field | New Field | | ||
| | ----------------- | ---------------- | | ||
| | `extraControlPlaneRules` | `controlPlane.egress` | | ||
| | `extraWorkloadRules` | `workload.egress` | | ||
| | `outgoingConnections.ipBlock` | `workload.publicEgress` | | ||
|
|
||
| <NetworkPolicy/> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this duplicate namespaceSelector intentional? It looks like it might be a copy-paste error.