美文网首页
centos7.7+ install microk8s

centos7.7+ install microk8s

作者: 小黑佬 | 来源:发表于2020-04-11 14:23 被阅读0次

操作前···请注意···本人使用的是香港vps,centos7.7

Enable snapd

yum install epel-release
yum install snapd
systemctl enable --now snapd.socket

[root@localhosts ~]# sudo systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/snapd.socket to /usr/lib/systemd/system/snapd.socket.

ln -s /var/lib/snapd/snap /snap

Install MicroK8s

sudo snap install microk8s --classic

2020-04-11T10:55:18+08:00 INFO Waiting for restart...
Warning: /var/lib/snapd/snap/bin was not found in your $PATH. If you've not
         restarted your session since you installed snapd, try doing that.
         Please see https://forum.snapcraft.io/t/9469 for more details.

microk8s v1.18.0 from Canonical✓ installed

至此 microk8s是安装成功,我们还得解决 PATH.

查看microk8s的状态,检查此部署的状态

$ microk8s.status 
#
microk8s is running
addons:
cilium: disabled
dashboard: disabled
dns: disabled
fluentd: disabled
gpu: disabled
helm: disabled
helm3: disabled
ingress: disabled
istio: disabled
jaeger: disabled
knative: disabled
kubeflow: disabled
linkerd: disabled
metallb: disabled
metrics-server: disabled
prometheus: disabled
rbac: disabled
registry: disabled
storage: disabled

$ microk8s.kubectl cluster-info
Kubernetes master is running at https://127.0.0.1:16443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

#获取k8s节点的状态:
$ microk8s.kubectl get nodes
NAME            STATUS   ROLES    AGE   VERSION
localhosts   Ready    <none>   27m   v1.18.0

# 获取k8s节点的状态:详细信息
$ microk8s.kubectl get nodes -o wide
NAME            STATUS   ROLES    AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                KERNEL-VERSION           CONTAINER-RUNTIME
localhosts   Ready    <none>   30m   v1.18.0   10.3.10.10    <none>        CentOS Linux 7 (Core)   3.10.0-1062.el7.x86_64   containerd://1.2.5

看到很多组件还没有启动···

$ snap info microk8s

name:      microk8s
summary:   Kubernetes for workstations and appliances
publisher: Canonical✓
store-url: https://snapcraft.io/microk8s
contact:   https://github.com/ubuntu/microk8s
license:   unset
description: |
  MicroK8s is a small, fast, secure, single node Kubernetes that installs on
  just about any Linux box. Use it for offline development, prototyping,
  testing, or use it on a VM as a small, cheap, reliable k8s for CI/CD. It's
  also a great k8s for appliances - develop your IoT apps for k8s and deploy
  them to MicroK8s on your boxes.
commands:
  - microk8s.add-node
  - microk8s.cilium
  - microk8s.config
  - microk8s.ctr
  - microk8s.disable
  - microk8s.enable
  - microk8s.helm
  - microk8s.helm3
  - microk8s.inspect
  - microk8s.istioctl
  - microk8s.join
  - microk8s.juju
  - microk8s.kubectl
  - microk8s.leave
  - microk8s.linkerd
  - microk8s
  - microk8s.remove-node
  - microk8s.reset
  - microk8s.start
  - microk8s.status
  - microk8s.stop
services:
  microk8s.daemon-apiserver:          simple, enabled, active
  microk8s.daemon-apiserver-kicker:   simple, enabled, active
  microk8s.daemon-cluster-agent:      simple, enabled, active
  microk8s.daemon-containerd:         simple, enabled, active
  microk8s.daemon-controller-manager: simple, enabled, active
  microk8s.daemon-etcd:               simple, enabled, active
  microk8s.daemon-flanneld:           simple, enabled, active
  microk8s.daemon-kubelet:            simple, enabled, active
  microk8s.daemon-proxy:              simple, enabled, active
  microk8s.daemon-scheduler:          simple, enabled, active
snap-id:      EaXxxxxxxkDCXRcg
tracking:     latest/stable
refresh-date: today at 10:57 CST
channels:
  stable:           v1.18.0         2020-04-01 (1320) 201MB classic
  candidate:        v1.18.1         2020-04-09 (1341) 201MB classic
  beta:             v1.18.1         2020-04-09 (1341) 201MB classic
  edge:             v1.18.1         2020-04-08 (1341) 201MB classic
  dqlite/stable:    –                                       
  dqlite/candidate: –                                       
  dqlite/beta:      –                                       
  dqlite/edge:      v1.16.2         2019-11-07 (1038) 189MB classic
  1.19/stable:      –                                       
  1.19/candidate:   –                                       
  1.19/beta:        –                                       
  1.19/edge:        v1.19.0-alpha.1 2020-03-26 (1311) 201MB classic
  1.18/stable:      v1.18.0         2020-04-01 (1319) 201MB classic
  1.18/candidate:   v1.18.0         2020-04-01 (1319) 201MB classic
  1.18/beta:        v1.18.0         2020-04-01 (1319) 201MB classic
  1.18/edge:        v1.18.1         2020-04-09 (1349) 201MB classic
  1.17/stable:      v1.17.4         2020-03-26 (1297) 179MB classic
  1.17/candidate:   v1.17.4         2020-03-26 (1297) 179MB classic
  1.17/beta:        v1.17.4         2020-03-26 (1297) 179MB classic
  1.17/edge:        v1.17.4         2020-03-26 (1297) 179MB classic
  1.16/stable:      v1.16.8         2020-03-27 (1302) 179MB classic
  1.16/candidate:   v1.16.8         2020-03-27 (1302) 179MB classic
  1.16/beta:        v1.16.8         2020-03-27 (1302) 179MB classic
  1.16/edge:        v1.16.8         2020-03-26 (1302) 179MB classic
  1.15/stable:      v1.15.11        2020-03-27 (1301) 171MB classic
  1.15/candidate:   v1.15.11        2020-03-27 (1301) 171MB classic
  1.15/beta:        v1.15.11        2020-03-27 (1301) 171MB classic
  1.15/edge:        v1.15.11        2020-03-26 (1301) 171MB classic
  1.14/stable:      v1.14.10        2020-01-06 (1120) 217MB classic
  1.14/candidate:   ↑                                       
  1.14/beta:        ↑                                       
  1.14/edge:        v1.14.10        2020-03-26 (1303) 217MB classic
  1.13/stable:      v1.13.6         2019-06-06  (581) 237MB classic
  1.13/candidate:   ↑                                       
  1.13/beta:        ↑                                       
  1.13/edge:        ↑                                       
  1.12/stable:      v1.12.9         2019-06-06  (612) 259MB classic
  1.12/candidate:   ↑                                       
  1.12/beta:        ↑                                       
  1.12/edge:        ↑                                       
  1.11/stable:      v1.11.10        2019-05-10  (557) 258MB classic
  1.11/candidate:   ↑                                       
  1.11/beta:        ↑                                       
  1.11/edge:        ↑                                       
  1.10/stable:      v1.10.13        2019-04-22  (546) 222MB classic
  1.10/candidate:   ↑                                       
  1.10/beta:        ↑                                       
  1.10/edge:        ↑                                       
installed:          v1.18.0                    (1320) 201MB classic

alias

alias kubectl='microk8s kubectl'

错误排除

too early for operation, device not yet seeded or device model not acknowledged
。。。
这个可能是snap 正在初始化···请耐心等待。

原文:
snap

相关文章

网友评论

      本文标题:centos7.7+ install microk8s

      本文链接:https://www.haomeiwen.com/subject/fytymhtx.html