3

I'm trying to build a local bare metal kubernetes cluster on ubuntu.

Following step by step guide (https://www.youtube.com/watch?v=UWg3ORRRF60) I've managed to install kubernetes master and have got the success message "Your Kubernetes master has initialized successfully!" after initializing the cluster with 'kubeadm init --pod-network-cidr=10.0.0.0/16 --apiserver-advertise-address=10.0.0.20' command.

Now the next step is to deploy a pod network so I have used calico, running the following command:

kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml --validate=false

And I get the output:

unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ConfigMap" in version "v1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "DaemonSet" in version "extensions/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "Service" in version "v1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "DaemonSet" in version "extensions/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ClusterRoleBinding" in version "rbac.authorization.k8s.io/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ClusterRole" in version "rbac.authorization.k8s.io/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ServiceAccount" in version "v1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ClusterRoleBinding" in version "rbac.authorization.k8s.io/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ClusterRole" in version "rbac.authorization.k8s.io/v1beta1"
unable to recognize "https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml": no matches for kind "ServiceAccount" in version "v1"

My kubectl version output is:

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:53:20Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Error from server (NotFound): the server could not find the requested resource

Would appreciate any help, even some advice for self debugging. Thanks.

MickyOwly
  • 43
  • 1
  • 7
  • It looks like something is gravely sick about the API; what are the logs from the `apiserver` container, as well as `kubelet` (likely running in systemd, so `journalctl -u kubelet.service`)? – mdaniel Aug 12 '18 at 04:40

2 Answers2

7

If kubernete version is above 1.16 then please use to following link to install calico.

kubectl apply -f https://docs.projectcalico.org/v3.9/manifests/calico.yaml

Please check the node status to confirm if calico is installed successfully. enter image description here

coredns and calico should be in running state.

enter image description here

Shahid Hussain
  • 1,599
  • 1
  • 20
  • 24
5

You have to use separate ranges for your pod-network-cidr and apiserver-advertise-address as it is stated in this post. Please try to remove the cluster and reinit it again with different network configuration:

Start with:

Run this to revert any changes made to this host by 'kubeadm init' or 'kubeadm join'.

kubeadm reset       

Then init the cluster again (IP address is a safe example).

kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=10.0.0.20 

Also if you are running that as in the tutorial you've linked on the master node you can skip --apiserver-advertise-address as it uses the default gateway of the current machine.

Run the standard commands from the kubeadm documentation

To make kubectl work for your non-root user, run these commands, which are also part of the kubeadm init output:

mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

After that install the network add-on: For Calico:

In order for Network Policy to work correctly, you need to pass --pod-network-cidr=192.168.0.0/16 to kubeadm init. Note that Calico works on amd64 only.

kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml You can also start from scratch with official Kubernetes documentation on how to install kubeadm.

aurelius
  • 3,433
  • 1
  • 13
  • 22