Skip to content

Commit

Permalink
Use cluster-dns IP setup by kubeadm
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vijaykatam committed Feb 3, 2020
1 parent c426650 commit 6c18456
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion pkg/minikube/bootstrapper/bsutil/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ var versionSpecificOpts = []config.VersionedExtraOption{
config.NewUnversionedOption(Kubelet, "config", "/var/lib/kubelet/config.yaml"),

// Network args
config.NewUnversionedOption(Kubelet, "cluster-dns", "10.96.0.10"),
config.NewUnversionedOption(Kubelet, "cluster-domain", "cluster.local"),

// Auth args
Expand Down

0 comments on commit 6c18456

Please sign in to comment.