k3s安装


官方文档
https://docs.rancher.cn/docs/k3s/installation/airgap/_index/

1. 文件准备

从: https://github.com/k3s-io/k3s/releases 下载如下两个文件

  • 二进制文件: k3s 文件
  • 镜像包:k3s-airgap-images-amd64.tar

image.png

2. 安装

  • k3s文件
chmod 755 k3s
cp k3s  /usr/local/bin/

/usr/local/bin/k3s 是后边安装的时候安装程序找二级制文件的默认位置

  • 镜像文件
    将镜像文件放到如下位置
mkdir -p /var/lib/rancher/k3s/agent/images/
cp ./k3s-airgap-images-amd64.tar /var/lib/rancher/k3s/agent/images/
curl -sfL https://get.k3s.io | sh -

离线安装可以将这个脚本下载下来,比如命名成install.sh

  • 安装
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
  • 后续操作

命令补全和k8s方法一致。看我k8s部署文档

3. 查看

[root@k3s-dev ~]# kubectl get node
NAME      STATUS   ROLES                  AGE    VERSION
k3s-dev   Ready    control-plane,master   3h8m   v1.20.6+k3s1
[root@k3s-dev ~]# kubectl get pod -n kube-system
NAME                                      READY   STATUS      RESTARTS   AGE
helm-install-traefik-lccnq                0/1     Completed   0          102m
svclb-traefik-mb2cg                       2/2     Running     2          100m
metrics-server-86cbb8457f-lkxt5           1/1     Running     1          3h8m
coredns-854c77959c-6bkf2                  1/1     Running     1          3h8m
local-path-provisioner-5ff76fc89d-zjl6z   1/1     Running     1          3h8m
traefik-6f9cbd9bd4-c5mvw                  1/1     Running     1          100m
[root@k3s-dev ~]# kubectl get namespaces
NAME              STATUS   AGE
mysql-test        Active   3h1m
kube-public       Active   3h8m
kube-node-lease   Active   3h8m
default           Active   3h8m
cattle-system     Active   52m
kube-system       Active   3h8m

4. rancher接入

和K8S一致,看我k8s的部署文档


posted on 2022-11-22 15:33  运维开发玄德公  阅读(99)  评论(0编辑  收藏  举报  来源

导航