简体   繁体   中英

How to start kubernetes on ubuntu?

When I install Kubernetes there's nothing wrong, but if I reboot the system, Kubernetes seems to stop running. It's not the same as this post: Running kubernetes on ubuntu

I've installed Kubernetes multiple ways, last way is through snap.

~$ snap list
Name       Version  Rev   Tracking  Publisher   Notes
core       16-2.42  7917  stable    canonical✓  core
kubectl    1.16.2   1309  stable    canonical✓  classic
notepadqq  1.4.8    855   stable    danieleds   -

After reboot the Kubernetes containers in Docker stops running:

:~$ docker ps -a
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                    PORTS               NAMES
5de66143e335        8454cbe08dc9           "/usr/local/bin/kube…"   15 hours ago        Exited (1) 11 hours ago                       k8s_kube-proxy_kube-proxy-rrbjb_kube-system_316b43ec-d268-4afb-b542-c09e857736b4_0
26b62f7fc060        k8s.gcr.io/pause:3.1   "/pause"                 15 hours ago        Exited (0) 10 hours ago                       k8s_POD_kube-proxy-rrbjb_kube-system_316b43ec-d268-4afb-b542-c09e857736b4_0
d1f3f60da435        b2756210eeab           "etcd --advertise-cl…"   15 hours ago        Exited (0) 10 hours ago                       k8s_etcd_etcd-slave-node_kube-system_161f34a5bdd3af3ef8001b343c96efef_0
2c14fc73f9bf        c2c9a0406787           "kube-apiserver --ad…"   15 hours ago        Exited (0) 10 hours ago                       k8s_kube-apiserver_kube-apiserver-slave-node_kube-system_a3c4ec33b7ecf145de3d55f76e5e4394_0
25b55f44caf4        ebac1ae204a2           "kube-scheduler --au…"   15 hours ago        Exited (2) 10 hours ago                       k8s_kube-scheduler_kube-scheduler-slave-node_kube-system_74dea8da17aa6241e5e4f7b2ba4e1d8e_0
0fb767d94a9c        6e4bffa46d70           "kube-controller-man…"   15 hours ago        Exited (2) 10 hours ago                       k8s_kube-controller-manager_kube-controller-manager-slave-node_kube-system_04a121c5d1d4d1f8b4ecc5ef4fd553e0_0
f5c30604a4cf        k8s.gcr.io/pause:3.1   "/pause"                 15 hours ago        Exited (0) 10 hours ago                       k8s_POD_etcd-slave-node_kube-system_161f34a5bdd3af3ef8001b343c96efef_0
400feedb3bb8        k8s.gcr.io/pause:3.1   "/pause"                 15 hours ago        Exited (0) 10 hours ago                       k8s_POD_kube-scheduler-slave-node_kube-system_74dea8da17aa6241e5e4f7b2ba4e1d8e_0
927c370e0e3d        k8s.gcr.io/pause:3.1   "/pause"                 15 hours ago        Exited (0) 10 hours ago                       k8s_POD_kube-controller-manager-slave-node_kube-system_04a121c5d1d4d1f8b4ecc5ef4fd553e0_0
750f3ee79cd1        k8s.gcr.io/pause:3.1   "/pause"                 15 hours ago        Exited (0) 10 hours ago                       k8s_POD_kube-apiserver-slave-node_kube-system_a3c4ec33b7ecf145de3d55f76e5e4394_0

I can't turn them back on except one by one. Is there a command like start kubectl or so? Because systemctl start kubectl says kubectl is not a service. I've seen a word like kubelet as well and kubeadm (which I installed previously and had the same problem).

Swap is turned off, like many posts say but it doesn't work. I followed the installation of Kubernetes.io with snap, as my latest installation where I think it should be okay.

So what is your advice in this?

First thing you need to check is the docker and kubelet. Install them as services and ensure they auto start after reboot.

If docker or kubelet are failed to start, investigate the reasons and make necessary configurations to get them started.

Right now I would start from removing everything you installed and try from scratch.

Depending on what kind of cluster you want to deploy, you have many options to choose from depending the installation of Kubernetes.

Installing Kubernetes with kops , or with Kubespray or kubeadm . You should follow the steps very closely to the very end.

You said the you used snap , it would seem that your snap paths are not updated correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM