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

Use cluster-dns IP setup by kubeadm #6472

Merged

Conversation

vijaykatam
Copy link
Contributor

@vijaykatam vijaykatam commented Feb 3, 2020

Removed hardcoded cluster-dns IP 10.96.0.10, this allows kubelet to use clusterDNS configured by kubeadm in /var/lib/kubelet/config.yaml

Tested by starting minikube with --service-cluster-ip-range=100.64.0.0/13 and verifying DNS resolution works.

/etc/systemd/system/kubelet.service.d/10-kubeadm.conf

[Unit]
Wants=docker.socket

[Service]
ExecStart=
ExecStart=/var/lib/minikube/binaries/v1.17.0/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver='cgroupfs' --client-ca-file=/v
ar/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=docker --fail-swap-on=false --hostname-override=minikube --kubeconfig=/e
tc/kubernetes/kubelet.conf --node-ip=192.168.64.7 --pod-manifest-path=/etc/kubernetes/manifests

[Install]

DNS resolution test

kubectl run -i --tty --rm busybox --image=busybox --restart=Never -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes.io
Server:		100.64.0.10
Address:	100.64.0.10:53

Non-authoritative answer:
Name:	kubernetes.io
Address: 147.75.40.148

Fixes: #5727

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 3, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @vijaykatam!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @vijaykatam. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 3, 2020
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vijaykatam
To complete the pull request process, please assign afbjorklund
You can assign the PR to them by writing /assign @afbjorklund in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@medyagh
Copy link
Member

medyagh commented Feb 3, 2020

@vijaykatam interesting PR ! I am curious if this will break anyone !
could we use the current behaviour if the user didn't pass a an extra settings?

btw the unit tests datas need to be updated for the PR.

@medyagh
Copy link
Member

medyagh commented Feb 3, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 3, 2020
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 3, 2020
@minikube-pr-bot
Copy link

Error: running mkcmp: exit status 1

@vijaykatam
Copy link
Contributor Author

could we use the current behaviour if the user didn't pass a an extra settings?

@medyagh if user didn't pass --service-cluster-ip-range the default behavior of kubeadm is to use 10.96.0.10, see https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/componentconfigs/kubelet.go#L108-L112. Since /var/lib/kubelet/config.yaml is already being passed in the kubelet drop-in, I guess always use clusterDNS specified by kubeadm?

@vijaykatam
Copy link
Contributor Author

I updated unit test setup data and they pass now. Integration test failures seem unrelated to this change.

@medyagh
Copy link
Member

medyagh commented Feb 5, 2020

Thanks @vijaykatam I will investigate, please run make lint
there are lint issues in travis.

@vijaykatam
Copy link
Contributor Author

@medyagh I didn't see lint errors running make lint. Travis build failure is not due to lint error

$ travis_setup_go
I don't have any idea what to do with '1.13.4'.
  (using download type 'auto')
Failed to run gimme
The command "travis_setup_go" failed and exited with 86 during .

I rebased with latest from master and I see 2 lint errors unrelated to my change which I am fixing.

pkg/minikube/cluster/start.go:189: File is not `goimports`-ed (goimports)
  if driver.BareMetal(h.Driver.DriverName()) {
pkg/addons/addons.go:211:2: printf: Infof format %s has arg command of wrong type *os/exec.Cmd (govet)
	glog.Infof("Running: %s", command)
	^

Removed hardcoded `cluster-dns` IP 10.96.0.10, this allows kubelet to use `clusterDNS` configured by kubeadm in `/var/lib/kubelet/config.yaml`

Tested by starting minikube with `--service-cluster-ip-range=100.64.0.0/13` and verifying DNS resolution works.

/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
```
[Unit]
Wants=docker.socket

[Service]
ExecStart=
ExecStart=/var/lib/minikube/binaries/v1.17.0/kubelet --authorization-mode=Webhook --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --cgroup-driver='cgroupfs' --client-ca-file=/v
ar/lib/minikube/certs/ca.crt --cluster-domain=cluster.local --config=/var/lib/kubelet/config.yaml --container-runtime=docker --fail-swap-on=false --hostname-override=minikube --kubeconfig=/e
tc/kubernetes/kubelet.conf --node-ip=192.168.64.7 --pod-manifest-path=/etc/kubernetes/manifests

[Install]
```

DNS resolution test
```
kubectl run -i --tty --rm busybox --image=busybox --restart=Never -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes.io
Server:		100.64.0.10
Address:	100.64.0.10:53

Non-authoritative answer:
Name:	kubernetes.io
Address: 147.75.40.148
```

Fixes: kubernetes#5727

fix lint errors
@codecov-io
Copy link

Codecov Report

Merging #6472 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6472   +/-   ##
=======================================
  Coverage   37.96%   37.96%           
=======================================
  Files         138      138           
  Lines        8698     8698           
=======================================
  Hits         3302     3302           
  Misses       4980     4980           
  Partials      416      416
Impacted Files Coverage Δ
pkg/minikube/bootstrapper/bsutil/versions.go 81.81% <ø> (ø) ⬆️
pkg/addons/addons.go 45.96% <0%> (ø) ⬆️
pkg/minikube/cluster/start.go 52.33% <0%> (ø) ⬆️

@tstromberg
Copy link
Contributor

Thank you!

@tstromberg tstromberg merged commit 852d617 into kubernetes:master Feb 5, 2020
nixpanic added a commit to nixpanic/ceph-csi that referenced this pull request Jul 9, 2020
We need a newer version that fixes kubernetes/minikube#6472.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
nixpanic added a commit to nixpanic/ceph-csi that referenced this pull request Jul 10, 2020
We need a newer version that fixes kubernetes/minikube#6472.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
nixpanic added a commit to nixpanic/ceph-csi that referenced this pull request Jul 30, 2020
We need a newer version that fixes kubernetes/minikube#6472.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing service cidr range breaks DNS resolution
7 participants