Skip to content
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

Still unable to manage all SGs outside K8S after PR #49445 #79723

Closed
ac-hibbert opened this issue Jul 3, 2019 · 12 comments · Fixed by #83446
Closed

Still unable to manage all SGs outside K8S after PR #49445 #79723

ac-hibbert opened this issue Jul 3, 2019 · 12 comments · Fixed by #83446
Labels
area/provider/aws Issues or PRs related to aws provider kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider.

Comments

@ac-hibbert
Copy link

ac-hibbert commented Jul 3, 2019

What happened:

  • Create SG outside of K8s - a SG rule has a range of ports which are opened via K8s
  • Add this into service.beta.kubernetes.io/aws-load-balancer-security-groups
  • Ensure load balancer switches from the range back to individual ports, the CIDR will be 0.0.0.0/0 if loadBalancerSourceRanges was removed too

What you expected to happen:

  • K8S doesn't modify the SG

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version): v1.13.7
  • Cloud provider or hardware configuration: EKS
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:
@ac-hibbert ac-hibbert added the kind/bug Categorizes issue or PR as related to a bug. label Jul 3, 2019
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jul 3, 2019
@ac-hibbert
Copy link
Author

/sig aws

@k8s-ci-robot k8s-ci-robot added sig/aws and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 3, 2019
@ac-hibbert
Copy link
Author

ac-hibbert commented Jul 3, 2019

#62774

@ac-hibbert
Copy link
Author

Note - I'm not sure if this is related to the aws cloud config, which I can't change as I'm using EKS

9f62e81

Add aws cloud config:

[global]
disableSecurityGroupIngress = true

@k8s-ci-robot k8s-ci-robot added area/provider/aws Issues or PRs related to aws provider needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. and removed sig/aws labels Aug 6, 2019
@nikhita
Copy link
Member

nikhita commented Aug 6, 2019

/sig cloud-provider

@k8s-ci-robot k8s-ci-robot added sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 6, 2019
@uty
Copy link

uty commented Aug 12, 2019

We're also having this issue which makes service.beta.kubernetes.io/aws-load-balancer-security-groups kinda unusable. EnsureLoadBalancer() shouldn't ensure permissions if an SG is a custom one here https://github.com/kubernetes/kubernetes/blob/release-1.13/pkg/cloudprovider/providers/aws/aws.go#L3579 .

@Raffo could you please take a look?

@caretak3r
Copy link

This is also an issue for us, using these service annotations should have been straightforward. A custom security group id used in the service.beta.kubernetes.io/aws-load-balancer-security-groups should ensure it's attached to the ELB/LB, and remain untouched.

Instead, this customer security group gets purged, leaving the port mapping untouched, but all sources become 0.0.0.0/0.

@Raffo
Copy link
Contributor

Raffo commented Aug 22, 2019

@uty unfortunately I can't, I don't have access at AWS resources to work on that. To be honest, it was pointed out a number of times that the load balancer code will need a refactor and better tests, I would suggest pinging AWS directly or bringing it up during the sig-aws meetings.

@caretak3r
Copy link

Suppose you have an existing EKS cluster, gateways, the whole nine yards...

Also, suppose you have a custom security group with entries already defined, for example, an SG that holds the rules of your corporate office network ranges, or even customer-specific IPs.

You expect, by using this SG id (sg-133780085) in conjunction with this service annotation that:

  • All other security groups kubernetes created during init would be "wiped away", and your custom SG would be the load-balancer's only security group (assuming you only had one).
  • All entries in your custom security group are intact, and would be retained by the control plane.

Gotcha, looks like it doesn't. It's reverted back to 0.0.0.0/0 as the source for all rules.

Temporary solution:

Run the override script (in our case, assign the serviceAnnotations to the gateway).
Still use a custom security group, but leave it empty.
When all and done, add your custom entries to the SG.

As of 08/22, this cheap workaround, works. Still needs investigating.

@caretak3r
Copy link

Suppose you have an existing EKS cluster, gateways, the whole nine yards...

Also, suppose you have a custom security group with entries already defined, for example, an SG that holds the rules of your corporate office network ranges, or even customer-specific IPs.

You expect, by using this SG id (sg-133780085) in conjunction with this service annotation that:

  • All other security groups kubernetes created during init would be "wiped away", and your custom SG would be the load-balancer's only security group (assuming you only had one).
  • All entries in your custom security group are intact, and would be retained by the control plane.

Gotcha, looks like it doesn't. It's reverted back to 0.0.0.0/0 as the source for all rules.

Temporary solution:

Run the override script (in our case, assign the serviceAnnotations to the gateway).
Still use a custom security group, but leave it empty.
When all and done, add your custom entries to the SG.

As of 08/22, this cheap workaround, works. Still needs investigating.

Any subsequent updates to the cluster, reverts all configurations back to 0.0.0.0/0. EKS was updated from eks.2 to eks.3. Which somehow triggered the changes with istio.

@awouda
Copy link

awouda commented Sep 26, 2019

Hi,

It looks I have the same issue. Company policy dictates that all SG's have a specific name.
Before: we just had service deployment which result in an auto-generated ELB with an auto-generated SG with the 'wrong' name, but everything was working fine.

I'm now in the process of getting the correct name. So I created a custom SG "A" which has ingress rules SG "A1" and "A2". I add this with
service.beta.kubernetes.io/aws-load-balancer-security-groups: "{elb-security-group-id}"
Now the elb is still auto-generated (as expected), but it only has 1 of the SG's from "A", being "A2" and a autogenerated one.
I added the a file with contents

[global]
disableSecurityGroupIngress = true

in the /etc/cloud/cloud.cfg.d location.

But I cannot get it to work.
We use as
service.beta.kubernetes.io/aws-load-balancer-internal: "0.0.0.0/0", which probably creates this extra rule.

I cannot find ( or am probably not able to read correctly) the correct config.
Should the aws-load-balancer-internal be used or not? Do I need another directive?

Maybe someone can help me out with some pointers?

Thanks in advance.

@khogeland
Copy link

It's possible to work around this by setting loadBalancerSourceRanges to something bogus (i.e. 127.0.0.1/32) and putting your desired SG in the service.beta.kubernetes.io/aws-load-balancer-extra-security-groups annotation instead (k8s won't modify this one).

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/aws Issues or PRs related to aws provider kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants