oomichi / try-kubernetes

12 stars 5 forks source link

Timeout happens during the control plane images are beeing pulled by kubeadm init #26

Closed oomichi closed 6 years ago

oomichi commented 6 years ago

https://github.com/oomichi/try-kubernetes/issues/25 作業中に発生した問題

# kubeadm init --pod-network-cidr=10.244.0.0/16
...
[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests".
[init] This might take a minute or longer if the control plane images have to be pulled.

Unfortunately, an error has occurred:
        timed out waiting for the condition

This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
        - Either there is no internet connection, or imagePullPolicy is set to "Never",
          so the kubelet cannot pull or find the following control plane images:
                - k8s.gcr.io/kube-apiserver-amd64:v1.10.4
                - k8s.gcr.io/kube-controller-manager-amd64:v1.10.4
                - k8s.gcr.io/kube-scheduler-amd64:v1.10.4
                - k8s.gcr.io/etcd-amd64:3.1.12 (only if no external etcd endpoints are configured)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'
couldn't initialize a Kubernetes cluster
oomichi commented 6 years ago

ubuntu 16.04 で発生するか、確認する。

$ nova boot --flavor m1.medium --image 7fd7db58-a369-4f0e-b596-35aab6df76f1 --key-name mykey k8s-1604

下記のとおり、ubuntu 16.04 では問題発生せず

# kubeadm init --pod-network-cidr=10.244.0.0/16
...
[init] This might take a minute or longer if the control plane images have to be pulled.
[apiclient] All control plane components are healthy after 69.502807 seconds
[uploadconfig]Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[markmaster] Will mark node k8s-1604 as master by adding a label and a taint
[markmaster] Master k8s-1604 tainted and labelled with key/value: node-role.kubernetes.io/master=""
[bootstraptoken] Using token: b0riz2.1ufwnc32j78yit4n
[bootstraptoken] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstraptoken] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstraptoken] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstraptoken] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[addons] Applied essential addon: kube-dns
[addons] Applied essential addon: kube-proxy

Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run the following 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:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

  kubeadm join 192.168.1.115:6443 --token b0riz2.1ufwnc32j78yit4n --discovery-token-ca-cert-hash sha256:32bfc4fa9066db4f221fb1facfb667dda3ffdca2b81f78965a9d644857eff718
$
oomichi commented 6 years ago

タイミング問題?(controller側のイメージ配布の問題?) もう一度 ubuntu 18.04 で試す。

oomichi commented 6 years ago

もしかしたら

echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list

で xenial を指定しているから? 現時点で https://packages.cloud.google.com/apt/dists 配下に kubernetes-xenial はあるけど、kubernetes-bionic はないなぁ。現時点で ubuntu 18.04 は使えないのかも。

oomichi commented 6 years ago
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list

で指定されるサイトに 18.04 (bionic)向けが無いため、現時点で 18.04 上に k8s cluster を kubeadm でインストールするのは不可能として close する。