-
Notifications
You must be signed in to change notification settings - Fork 34
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
Dynamically assign DNS IP using cni-env #210
Conversation
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 it not better to simply deploy the service without a fixed IP address, and then query KubeAPIserver with the address?
I cannot see the reason to add all this logic just to pick a random IP of a valid range, when Kubernetes will do that for us either way.
33fb927
to
e484bb7
Compare
We now assign DNSIP after deploying the service and assign arguments in kubelet based on the Cluster IP assigned to the DNS service. We also remove DNSIPARGS and assign IP to the DNS service dynamically only. |
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 works much better. However, setting the DNS IP address as a second argument must still be supported.
You can support both by setting clusterIP
if $2 is provided, otherwise leave it as an empty value.
But the DNSIP env variable cannot be an empty value inside the manifest. Otherwise we will get errors like:
|
Yes, this is because # works
apiVersion: v1
kind: Service
metadata:
name: svc-1
spec:
clusterIP:
ports:
- port: 80
protocol: TCP
targetPort: 80
---
# does not work
apiVersion: v1
kind: Service
metadata:
name: svc-2
spec:
clusterIP: "$DNSIP"
ports:
- port: 80
protocol: TCP
targetPort: 80 |
b225212
to
207893f
Compare
670c506
to
adaafe4
Compare
Summary
Earlier we used to assign DNS IP statically. But now we use the CIDR in cni-env to assign a valid IP from that range removing hard-coded IP.
We add new utilities in the utils.sh to calculate and test a valid IP from the cidr. Not using external utils like
ipcalc
, as they may not be present in every system.