{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18626","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18626/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18626/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18626/events","html_url":"https://github.com/kubernetes/kubernetes/issues/18626","id":121885049,"number":18626,"title":"Can't setup DNS add-on with local Docker setup","user":{"login":"ericandrewlewis","id":1087646,"avatar_url":"https://avatars.githubusercontent.com/u/1087646?v=3","gravatar_id":"","url":"https://api.github.com/users/ericandrewlewis","html_url":"https://github.com/ericandrewlewis","followers_url":"https://api.github.com/users/ericandrewlewis/followers","following_url":"https://api.github.com/users/ericandrewlewis/following{/other_user}","gists_url":"https://api.github.com/users/ericandrewlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/ericandrewlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericandrewlewis/subscriptions","organizations_url":"https://api.github.com/users/ericandrewlewis/orgs","repos_url":"https://api.github.com/users/ericandrewlewis/repos","events_url":"https://api.github.com/users/ericandrewlewis/events{/privacy}","received_events_url":"https://api.github.com/users/ericandrewlewis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-12T22:35:14Z","updated_at":"2015-12-13T20:42:26Z","closed_at":null,"body":"I've successfully set up Kubernetes on Docker locally following the [Getting Started Guide](https://github.com/kubernetes/kubernetes/blob/release-1.1/docs/getting-started-guides/docker.md). \r\n\r\nNow I'm trying to setup the DNS add-on, and having issues. This might be a dupe of #16836, but I don't want to add noise to that discussion if it isn't.\r\n\r\nI've modified the `kubelet` boot-up command according to [the DNS add-on configuration](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns#how-do-i-configure-it), so that looks like\r\n\r\n```bash\r\ndocker run \\\r\n    --volume=/:/rootfs:ro \\\r\n    --volume=/sys:/sys:ro \\\r\n    --volume=/dev:/dev \\\r\n    --volume=/var/lib/docker/:/var/lib/docker:ro \\\r\n    --volume=/var/lib/kubelet/:/var/lib/kubelet:rw \\\r\n    --volume=/var/run:/var/run:rw \\\r\n    --net=host \\\r\n    --pid=host \\\r\n    --privileged=true \\\r\n    -d \\\r\n    gcr.io/google_containers/hyperkube:v1.0.1 \\\r\n    /hyperkube kubelet --containerized --hostname-override=\"127.0.0.1\" --address=\"0.0.0.0\" --api-servers=http://localhost:8080 --config=/etc/kubernetes/manifests --cluster-dns=10.0.0.10 --cluster-domain=cluster.local\r\n```\r\n\r\nAnd I've booted up the DNS service and replication controller based on the examples in the docs ([rc](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/skydns-rc.yaml.in), [svc](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/skydns-svc.yaml.in)) modifying templating variables accordingly. \r\n\r\nHere's the rc:\r\n\r\n```yaml\r\napiVersion: v1\r\nkind: ReplicationController\r\nmetadata:\r\n  name: kube-dns-v9\r\n  namespace: kube-system\r\n  labels:\r\n    k8s-app: kube-dns\r\n    version: v9\r\n    kubernetes.io/cluster-service: \"true\"\r\nspec:\r\n  replicas: 1\r\n  selector:\r\n    k8s-app: kube-dns\r\n    version: v9\r\n  template:\r\n    metadata:\r\n      labels:\r\n        k8s-app: kube-dns\r\n        version: v9\r\n        kubernetes.io/cluster-service: \"true\"\r\n    spec:\r\n      containers:\r\n      - name: etcd\r\n        image: gcr.io/google_containers/etcd:2.0.9\r\n        resources:\r\n          limits:\r\n            cpu: 100m\r\n            memory: 50Mi\r\n        command:\r\n        - /usr/local/bin/etcd\r\n        - -data-dir\r\n        - /var/etcd/data\r\n        - -listen-client-urls\r\n        - http://127.0.0.1:2379,http://127.0.0.1:4001\r\n        - -advertise-client-urls\r\n        - http://127.0.0.1:2379,http://127.0.0.1:4001\r\n        - -initial-cluster-token\r\n        - skydns-etcd\r\n        volumeMounts:\r\n        - name: etcd-storage\r\n          mountPath: /var/etcd/data\r\n      - name: kube2sky\r\n        image: gcr.io/google_containers/kube2sky:1.11\r\n        resources:\r\n          limits:\r\n            cpu: 100m\r\n            memory: 50Mi\r\n        args:\r\n        # command = \"/kube2sky\"\r\n        - -domain=cluster.local\r\n      - name: skydns\r\n        image: gcr.io/google_containers/skydns:2015-10-13-8c72f8c\r\n        resources:\r\n          limits:\r\n            cpu: 100m\r\n            memory: 50Mi\r\n        args:\r\n        # command = \"/skydns\"\r\n        - -machines=http://127.0.0.1:4001\r\n        - -addr=0.0.0.0:53\r\n        - -ns-rotate=false\r\n        - -domain=cluster.local.\r\n        ports:\r\n        - containerPort: 53\r\n          name: dns\r\n          protocol: UDP\r\n        - containerPort: 53\r\n          name: dns-tcp\r\n          protocol: TCP\r\n        livenessProbe:\r\n          httpGet:\r\n            path: /healthz\r\n            port: 8080\r\n            scheme: HTTP\r\n          initialDelaySeconds: 30\r\n          timeoutSeconds: 5\r\n        readinessProbe:\r\n          httpGet:\r\n            path: /healthz\r\n            port: 8080\r\n            scheme: HTTP\r\n          initialDelaySeconds: 1\r\n          timeoutSeconds: 5\r\n      - name: healthz\r\n        image: gcr.io/google_containers/exechealthz:1.0\r\n        resources:\r\n          limits:\r\n            cpu: 10m\r\n            memory: 20Mi\r\n        args:\r\n        - -cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null\r\n        - -port=8080\r\n        ports:\r\n        - containerPort: 8080\r\n          protocol: TCP\r\n      volumes:\r\n      - name: etcd-storage\r\n        emptyDir: {}\r\n      dnsPolicy: Default  # Don't use cluster DNS.\r\n```\r\n\r\nand the service:\r\n\r\n```yaml\r\napiVersion: v1\r\nkind: Service\r\nmetadata:\r\n  name: kube-dns\r\n  namespace: kube-system\r\n  labels:\r\n    k8s-app: kube-dns\r\n    kubernetes.io/cluster-service: \"true\"\r\n    kubernetes.io/name: \"KubeDNS\"\r\nspec:\r\n  selector:\r\n    k8s-app: kube-dns\r\n  clusterIP: 10.0.0.10\r\n  ports:\r\n  - name: dns\r\n    port: 53\r\n    protocol: UDP\r\n  - name: dns-tcp\r\n    port: 53\r\n    protocol: TCP\r\n```\r\n\r\nI've turned off the liveness and readiness probe, because they are causing infinite pod restarts.\r\n\r\nAttempting to do an nslookup inside of a container returns the wrong IP for the kubernetes.default service. Expected: 10.0.0.1, actual: 198.105.254.228.\r\n\r\n```\r\ndocker@kubernetes:~$ kubectl exec busybox -- nslookup kubernetes.default\r\nServer:    10.0.0.10\r\nAddress 1: 10.0.0.10\r\n\r\nName:      kubernetes.default\r\nAddress 1: 198.105.254.228\r\nAddress 2: 198.105.244.228\r\ndocker@kubernetes:~$ kubectl exec busybox -- nslookup \r\ndocker@kubernetes:~$ kubectl get services\r\nNAME         LABELS                                    SELECTOR    IP(S)       PORT(S)\r\nkubernetes   component=apiserver,provider=kubernetes   <none>      10.0.0.1    443/TCP\r\nnginx        run=nginx                                 run=nginx   10.0.0.49   80/TCP\r\n```\r\n\r\nLooking into the logs, it looks like kube2sky can't talk to the Kubernetes API.\r\n\r\n```\r\ndocker@kubernetes:~$ kubectl logs --namespace=kube-system kube-dns-v9-ooz2c kube2sky\r\nI1212 21:56:51.986778       1 kube2sky.go:389] Etcd server found: http://127.0.0.1:4001\r\nI1212 21:56:52.990598       1 kube2sky.go:455] Using http://localhost:8080 for kubernetes master\r\nI1212 21:56:52.990611       1 kube2sky.go:456] Using kubernetes API \r\nE1212 21:56:52.991696       1 reflector.go:136] Failed to list *api.Service: couldn't get version/kind; json parse error: invalid character '<' looking for beginning of value\r\nE1212 21:56:52.991794       1 reflector.go:136] Failed to list *api.Endpoints: couldn't get version/kind; json parse error: invalid character '<' looking for beginning of value\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/164296405","html_url":"https://github.com/kubernetes/kubernetes/issues/18626#issuecomment-164296405","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18626","id":164296405,"user":{"login":"ericandrewlewis","id":1087646,"avatar_url":"https://avatars.githubusercontent.com/u/1087646?v=3","gravatar_id":"","url":"https://api.github.com/users/ericandrewlewis","html_url":"https://github.com/ericandrewlewis","followers_url":"https://api.github.com/users/ericandrewlewis/followers","following_url":"https://api.github.com/users/ericandrewlewis/following{/other_user}","gists_url":"https://api.github.com/users/ericandrewlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/ericandrewlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericandrewlewis/subscriptions","organizations_url":"https://api.github.com/users/ericandrewlewis/orgs","repos_url":"https://api.github.com/users/ericandrewlewis/repos","events_url":"https://api.github.com/users/ericandrewlewis/events{/privacy}","received_events_url":"https://api.github.com/users/ericandrewlewis/received_events","type":"User","site_admin":false},"created_at":"2015-12-13T20:42:26Z","updated_at":"2015-12-13T20:42:26Z","body":"If i run `hostname -i` inside the VM running Kubernetes, I see `127.0.0.1`, i.e. `localhost`. I guess this is part of the problem — the machine provisioned in the guide doesn't have an IP addressable from inside of a container?"}}