-
Notifications
You must be signed in to change notification settings - Fork 280
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
Container Load Balancer - Network Security Group (NSG) #8054
base: master
Are you sure you want to change the base?
Conversation
|
Welcome @georgeedward2000! |
Hi @georgeedward2000. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
} | ||
if wantLb && !lbFound { | ||
logger.Error(err, "Failed to get load balancer") | ||
return nil, fmt.Errorf("unable to get lb %s", lbName) | ||
} | ||
var backendIPv4List, backendIPv6List []string | ||
if lbFound { |
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.
For POD IP based backendpool, we are not populating the POD IPs in the NSG. Rather, the POD subnet. So, we could skip GetBackendPrivateIPs for POD IP based Backend pool.
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.
This is part of the initial flow - node ip based backendpool
It is part of the block that is on the else branch of :
if az.IsLBBackendPoolTypePodIP() {
} else {
// HERE
}
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: georgeedward2000, kartickmsft The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pkg/provider/azure_loadbalancer.go
Outdated
az.PodCidrIPv6 = prefix | ||
} | ||
} | ||
az.RetrievedClusterPodCidr = true |
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.
Can podcidrs change during cluster operations (eg. adding new node pool)? If yes, then do we need to handle this differently to account for potential new cidrs?
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.
From what I understand, the pod subnet (hence the cidr) is set during cluster's deployment and cannot be updated during its lifetime. Please confirm @kartickmsft
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.
I think that can happen when completely new node pool is added: https://learn.microsoft.com/en-us/azure/aks/create-node-pools#add-a-node-pool-with-a-unique-subnet
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.
POD subnet can be newly configured for a new nodepool for Azure CNI Dynamic IP allocation and Enhanced subnet option (https://learn.microsoft.com/en-us/azure/aks/configure-azure-cni-dynamic-ip-allocation#adding-node-pool).
So, yeah, we need to handle it differently. As per my understanding, cloud-provider doesn't get any notification about nodepool addition/deletion. If this understanding is correct, maybe reading PODCIDRs each time maybe the only option.
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.
yes, it may change. We'd need to figure out a way to get notified on such changes
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.
If this understanding is correct, maybe reading PODCIDRs each time maybe the only option.
This may be not enough as there may be down times when new IPs are picked while they are blocked by NSG.
@@ -47,6 +47,18 @@ func (f *AzureLoadBalancerFixture) IPv4Addresses() []string { | |||
} |
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.
Can you add some details about the change in the PR description?
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.
updated the PR description
@georgeedward2000 Thanks for the contribution. Could you sign CLA? |
And could you use the template (the template would show when you open the PR) and fill the template contents (including release notes information together with what this PR does)? /kind feature |
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.
As discussed, there is a security limitation of current design, please also add it as comments and TODOs.
pkg/provider/azure_loadbalancer.go
Outdated
{ | ||
|
||
if az.IsLBBackendPoolTypePodIP() { | ||
if !az.RetrievedClusterPodCidr { |
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.
Generally, this would block the security boundary of the Kubernetes cluster. The cluster identity should not have the permission to manage itself.
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.
let's use new cloud config options and ask the provisioning service (e.g. AKS or capz) to setup the CIDRs on changing.
pkg/provider/config/azure.go
Outdated
// If the pod subnet prefix is not set, the value is false. | ||
// If the pod subnet prefix is set, the value is true. | ||
// Note: Multiple rules per subnet with different protocols and destination ports can exist. | ||
RetrievedClusterPodCidr bool `json:"retrievedClusterPodCidr" yaml:"retrievedClusterPodCidr"` |
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.
As commented, let's remove this option and ask provisioning service to set the PodCIDRs
pkg/provider/config/azure.go
Outdated
// PodCidrIPv6 is the IPv6 pod subnet prefix for the cluster. | ||
// The pod subnet prefix is used to configure the NSG for the pod subnet. | ||
PodCidrIPv4 netip.Prefix `json:"podCidrIPv4" yaml:"podCidrIPv4"` | ||
PodCidrIPv6 netip.Prefix `json:"podCidrIPv6" yaml:"podCidrIPv6"` |
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.
For extensibility, let's use LIST here?
|
||
// PodCidrIPv4 is the IPv4 pod subnet prefix for the cluster. | ||
// PodCidrIPv6 is the IPv6 pod subnet prefix for the cluster. | ||
// The pod subnet prefix is used to configure the NSG for the pod subnet. |
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.
Could you also add a message to say all Pod CIDR would be opened to internet by default?
and add a TODO comment to improve the security later?
Let's also bake some tests. /ok-to-test |
Co-authored-by: David Kowalski <[email protected]>
8bf63d9
to
9141356
Compare
Adding label Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/label tide/merge-method-squash |
What type of PR is this?
/kind feature
What this PR does / why we need it:
For a container load balancer (CLB) with floating IP disabled, the Network Security Group (NSG) must allow traffic to dynamic pod IPs. To manage this:
This setup ensures secure and efficient communication with the pod backend pool.
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: