k3s部署全过程

乎语百科 275 0
# 安装k3s博客
## 准备工作
1.准备俩台可以相互访问的服务器
2.需要先安装dockers
3.以下教程将使用VsCode+ssh插件来进行插件图

ssh连接到俩台服务器

点击打开ssh操作界面

进入需要设置master节点的服务器中然后执行docker命令启动一个autok3s的容器并且需要将docker映射进去 注:如果选择使用docker做为k3s的运行容器必须映射docker进去

 docker run -itd --restart=unless-stopped --name autok3s --net=host -v /var/run/docker.sock:/var/run/docker.sock cnrancher/autok3s:v0.5.2

容器启动完成以后访问服务器 ip:8080 然后点击Core/Clusters

点击Create创建一个Cluster

选择Native

安装的基本参数设置 设置master节点ip 设置node节点ip 俩台服务器密码需要一直

设置k3s options

点击右下角的create

等待k3s安装部署完成 需要很长一段时间

我们可以先安装k3s的管理界面 安装我们的kuboard管理界面

docker run --restart=unless-stopped -p 8088:80 -d --name kuboard -e KUBOARD_AGENT_SERVER_TCP_PORT=8088 -e KUBOARD_ENDPOINT=https://192.168.1.11  -v /root/kuboard-data:/data  eipwork/kuboard:v3

然后访问ip:8088 我们可以看到kuboard的界面

默认账号:admin

默认密码:Kuboard123

登录成功进入界面 等待k3s安装完成 点击Kubernetes的添加集群

点击 .kubeconfig

找到master节点下的k3s配置

路径 /etc/rancher/k3s/k3s.yaml

修改内部的server ip为master节点的ip

示例

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUyTmpReU1ESTBNRGd3SGhjTk1qSXdPVEkyTVRReU5qUTRXaGNOTXpJd09USXpNVFF5TmpRNApXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUyTmpReU1ESTBNRGd3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFRdmJOZEdiNDAvWmR4L2JiRjgzZXZObGFsUFVXTm5KMmp6UFZoT0k4VXAKR1QyeXQ1b0FCTEs2a0diWnVEbkowTE9GYnBudXZFMUkyRFl0d2RxMmh3YnFvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVXA1YU5GZlU5U0R3dFVoQlZJVTNUCkc4UTgwa293Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUloQUlxcVhMNFBVa0xsdld3T3hmZ3M2NFNhSHBobFgvaW8KVFJJME9MdnR5VmRXQWlBcFhrcndLRmZBYmFmSDNkZnNjY0dIbGYvdVpMbTJaNG1WeURRZmE4dUtPUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://192.168.1.11:6443
  name: default
contexts:
- context:
    cluster: default
    user: default
  name: default
current-context: default
kind: Config
preferences: {}
users:
- name: default
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrVENDQVRlZ0F3SUJBZ0lJQ0NjT1VkbCtEZzR3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOalkwTWpBeU5EQTRNQjRYRFRJeU1Ea3lOakUwTWpZME9Gb1hEVEl6TURreQpOakUwTWpZME9Gb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJJQWZuSncrVVVOaUdsN3QKWGhMUFZDTUpyWHIraFUvWVU4SVNoRVNtQktucng0eWZ4NUQ3TnpTdkR5YUdldjk3SVJDUGlKUktvaENFMGlnMwp1Z3I5b1RlalNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2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Ck1IY0NBUUVFSUd6VldKY1JpUkljLzFWTnc0UGRKckZFbEk2cisyUkdWWDJMQ0tsZldibnRvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFZ0IrY25ENVJRMklhWHUxZUVzOVVJd210ZXY2RlQ5aFR3aEtFUktZRXFldkhqSi9Ia1BzMwpOSzhQSm9aNi8zc2hFSStJbEVxaUVJVFNLRGU2Q3YyaE53PT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=

  将其复制到 KubeConfig 里面 填写名称和描述 然后点击确定

点击确认以后进入这个界面 然后选择kuboard-admin 再点击集群概要

进入到kuboard的管理界面就完成了 如果node节点的服务器并没有加入到master节点请查阅资料或者加群交流 群:737776595

标签:

留言评论

  • 这篇文章还没有收到评论,赶紧来抢沙发吧~