I am new to Kubernetes, so some of my questions may be basic.
NOTE: REMOVED http::// and https::// URL references in commands and output below, since there is a limit to number of URLs in a question.
My setup: 1 Physical host machine(running Ubuntu 16.04), with bridge networking enabled.
2 Ubuntu 16.04 VMs(Virtual Machines), VM1 is Master Node. VM2 is Slave Node.
I have a router, so behind the router both VMs get local IP address(ie not public IP address). Since I am on corporate network, I also have proxy settings. I have browser, apt, curl and wget applications working fine. Able to ping between VM1 and VM2.
Kubernetes Version: 1.7.0 on both Master Node(Virtual Machine-VM1) and Slave Node(Virtual Machine-VM2)
My Steps: 1. On both Master and Slave Nodes, installed the required kubernetes(kubelet kubeadm kubectl kubernetes-cni) packages and docker(docker.io) packages.
On the Master Node: 1. On the Master Node, when I run kubeadmin init, I was getting the following tcp timeout error:
sudo kubeadm init --apiserver-advertise-address=192.168.1.104 --pod-network-cidr=10.244.0.0/16 –skip-preflight- -checks
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters. unable to get URL "storage.googleapis.com/kubernetes-release/release/stable-1.7.txt": Get storage.googleapis.com/kubernetes-release/release/stable-1.7.txt: dial tcp 172.217.3.208:443: i/o timeout
- So tried specifying the kubernetes version, since I read that this prevents fetch from external website, and with that kubeadmin init was successful.
sudo kubeadm init --kubernetes-version v1.7.0 --apiserver-advertise-address=192.168.1.104 --pod-network-cidr=10.244.0.0/16 --skip-preflight-checks
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters. [init] Using Kubernetes version: v1.7.0
[init] Using Authorization modes: [Node RBAC]
[preflight] Skipping pre-flight checks
[certificates] Using the existing CA certificate and key.
[certificates] Using the existing API Server certificate and key.
[certificates] Using the existing API Server kubelet client certificate and key.
[certificates] Using the existing service account token signing key.
[certificates] Using the existing front-proxy CA certificate and key.
[certificates] Using the existing front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Using existing up-to-date KubeConfig file: "/etc/kubernetes/admin.conf"
[kubeconfig] Using existing up-to-date KubeConfig file: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Using existing up-to-date KubeConfig file: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Using existing up-to-date KubeConfig file: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 14.009367 seconds
[token] Using token: ec4877.23c06ac2adf9d66c [apiconfig] Created RBAC rules
[addons] Applied essential addon: kube-proxy
[addons] Applied essential addon: kube-dns
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run (as a regular user):
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: kubernetes.io/docs/admin/addons/
You can now join any number of machines by running the following on each node as root:
kubeadm join --token ec4877.23c06ac2adf9d66c 192.168.1.104:6443
Ran the below commands and they went through fine. mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
Tried to deploy a pod network to the cluster, but fails with the same tcp timeout error:
kubectl apply -f docs.projectcalico.org/v2.3/ getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml
Unable to connect to the server: dial tcp 151.101.0.133:80: i/o timeout
- Downloaded the calico.yaml file using browser, and ran the command, it was successful.
skris14@skris14-ubuntu16:~/Downloads$ sudo kubectl apply -f ~/Downloads/calico.yaml
configmap "calico-config" created
daemonset "calico-etcd" created
service "calico-etcd" created
daemonset "calico-node" created
deployment "calico-policy-controller" created
clusterrolebinding "calico-cni-plugin" created
clusterrole "calico-cni-plugin" created
serviceaccount "calico-cni-plugin" created
clusterrolebinding "calico-policy-controller" created
clusterrole "calico-policy-controller" created
serviceaccount "calico-policy-controller" created
On the Slave Node:
Note: I am able to do a basic ping test, and ssh, scp commands between the master node running in VM1 and slave node running in VM2 works fine.
- Ran the join command, and it fails trying to get cluster info.
Output of join command in slave node: skris14@sudha-ubuntu-16:~$ sudo kubeadm join --token ec4877.23c06ac2adf9d66c 192.168.1.104:6443
[sudo] password for skris14:
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[preflight] Running pre-flight checks
[discovery] Trying to connect to API Server "192.168.1.104:6443"
[discovery] Created cluster-info discovery client, requesting info from "192.168.1.104:6443"
[discovery] Failed to request cluster info, will try again: [Get 192.168.1.104:6443/: EOF] ^C
Output of Status Commands On the Master Node:
skris14@skris14-ubuntu16:~/Downloads$ kubectl get nodes
NAME STATUS AGE VERSION skris14-ubuntu16.04-vm1 Ready 5d v1.7.0
skris14@skris14-ubuntu16:~/Downloads$ kubectl cluster-info
Kubernetes master is running at 192.168.1.104:6443
KubeDNS is running at 192.168.1.104:6443/api/v1/namespaces/kube-system/services/kube-dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
skris14@skris14-ubuntu16:~/Downloads$ kubectl get pods --namespace=kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE
calico-etcd-2lt0c 1/1 Running 0 14m 192.168.1.104 skris14-ubuntu16.04-vm1
calico-node-pp1p9 2/2 Running 0 14m 192.168.1.104 skris14-ubuntu16.04-vm1
calico-policy-controller-1727037546-m6wqt 1/1 Running 0 14m 192.168.1.104 skris14-ubuntu16.04-vm1
etcd-skris14-ubuntu16.04-vm1 1/1 Running 1 5d 192.168.1.104 skris14-ubuntu16.04-vm1
kube-apiserver-skris14-ubuntu16.04-vm1 1/1 Running 0 3m 192.168.1.104 skris14-ubuntu16.04-vm1
kube-controller-manager-skris14-ubuntu16.04-vm1 1/1 Running 0 4m 192.168.1.104 skris14-ubuntu16.04-vm1
kube-dns-2425271678-b05v8 0/3 Pending 0 4m
kube-dns-2425271678-ljsv1 0/3 OutOfcpu 0 5d skris14-ubuntu16.04-vm1
kube-proxy-40zrc 1/1 Running 1 5d 192.168.1.104 skris14-ubuntu16.04-vm1
kube-scheduler-skris14-ubuntu16.04-vm1 1/1 Running 5 5d 192.168.1.104 skris14-ubuntu16.04-vm1
Output of ifconfig on Master Node(Virtual Machine1):
skris14@skris14-ubuntu16:~/
docker0 Link encap:Ethernet HWaddr 02:42:7f:ee:8e:b7 inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ens3 Link encap:Ethernet HWaddr 52:54:be:36:42:a6 inet addr:192.168.1.104 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::c60c:647d:1d9d:aca1/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:184500 errors:0 dropped:35 overruns:0 frame:0 TX packets:92411 errors:0 dropped:0 overruns:0 carrier:0 collisions:458827 txqueuelen:1000 RX bytes:242793144 (242.7 MB) TX bytes:9162254 (9.1 MB)
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:848277 errors:0 dropped:0 overruns:0 frame:0 TX packets:848277 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:211936528 (211.9 MB) TX bytes:211936528 (211.9 MB)
tunl0 Link encap:IPIP Tunnel HWaddr inet addr:192.168.112.192 Mask:255.255.255.255 UP RUNNING NOARP MTU:1440 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Output of ifconfig on Slave Node(Virtual Machine2):
skris14@sudha-ubuntu-16:~$ ifconfig docker0 Link encap:Ethernet HWaddr 02:42:69:5e:2d:22 inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
ens3 Link encap:Ethernet HWaddr 52:54:be:36:42:b6 inet addr:192.168.1.105 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::cadb:b714:c679:955/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:72280 errors:0 dropped:0 overruns:0 frame:0 TX packets:36977 errors:0 dropped:0 overruns:0 carrier:0 collisions:183622 txqueuelen:1000 RX bytes:98350159 (98.3 MB) TX bytes:3431313 (3.4 MB)
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:1340 errors:0 dropped:0 overruns:0 frame:0 TX packets:1340 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:130985 (130.9 KB) TX bytes:130985 (130.9 KB)