-
Notifications
You must be signed in to change notification settings - Fork 524
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
aws-k8s: get cluster dns cidr from eks #1547
Conversation
Add Bottlerocket API call to get the AWS region before working on the rebase to pull in #1551. |
Rebase. |
Fix an oops (region URI was wrong) |
Retest checks out. |
I think this addresses all of @tjkirch 's suggestion except for using the Model struct, which I will address separately. |
Use the API via strongly-typed settings instead of poking into a serde::json object. This requires conditional compilation to preserve the usability of the |
Retest checks out with 7325837. CI failure is a flake but not re-running because there are some small things to push. |
Fix some nits. |
Additional cleanups. |
We previously assumed that an EKS cluster DNS IP was either 10.100.0.10 or 172.20.0.10. This may be incorrect when the cluster has a custom serviceIPv4CIDR setting. Now we get the serviceIPv4CIDR from EKS describe-cluster so that we can calculate the correct cluster DNS IP in the presence of serviceIPv4CIDR.
Spelling fix. |
Issue number:
Closes #1197
Description of changes:
We previously assumed that an EKS cluster DNS IP was either 10.100.0.10 or 172.20.0.10. This may be incorrect when the cluster has a custom serviceIPv4CIDR setting.
Now we get the serviceIPv4CIDR from EKS describe-cluster so that we can calculate the correct cluster DNS IP in the presence of serviceIPv4CIDR.
Notes
reqwest::blocking
toreqwest
async for the IMDS calls because we need a runtime for rusoto.Testing done:
Reproducing the issue before fixing it:
After reading this
10.31.32.0/24
.10.100.0.10
.kubectl run -i -t ubuntu --image=ubuntu --restart=Never --command=true -- bash
nslookup kubernetes.default
, which returnedIn a healthy, non-custom-CIDR cluster, the above produces:
Thus we have proven that Bottlerocket does not work correctly with a custom
serviceIPv4CIDR
.Testing this PR
Custom CIDR Cluster
serviceIPv4CIDR: '10.31.32.0/24'
apiclient -u /settings?keys=settings.kubernetes.cluster-dns-ip
{"kubernetes":{"cluster-dns-ip":"10.31.32.10"}}
kubectl run -i -t ubuntu --image=ubuntu --restart=Never --command=true -- bash
nslookup kubernetes.default
The result shows that cluster DNS resolution is working:
Non-Custom CIDR Cluster
serviceIPv4CIDR
configuration.apiclient -u /settings?keys=settings.kubernetes.cluster-dns-ip
{"kubernetes":{"cluster-dns-ip":"10.100.0.10"}}
kubectl run -i -t ubuntu --image=ubuntu --restart=Never --command=true -- bash
nslookup kubernetes.default
The result shows that cluster DNS resolution is working:
Without Describe Cluster Permissions
serviceIPv4CIDR
configuration and with DescribeCluster removed from the Node's instance role.Unable to determine CIDR from EKS, falling back to default cluster DNS IP: Error describing cluster: Request ID: Some("9753370c-9443-455c-91b4-a182491bcf1e") Body: {"message":"User: arn:aws:sts::xxx:assumed-role/ [...] is not authorized to perform: eks:DescribeCluster on resource: [..."}
apiclient -u /settings?keys=settings.kubernetes.cluster-dns-ip
{"kubernetes":{"cluster-dns-ip":"10.100.0.10"}}
kubectl run -i -t ubuntu --image=ubuntu --restart=Never --command=true -- bash
nslookup kubernetes.default
The result shows that cluster DNS resolution is working despite failure to call the EKS API and describe-cluster:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.