Kubernetes
1.Kubernetes安装配置
Ubuntu安装containerd
更换Ubuntu安装源
2.Kubernetes集群管理
服务质量QoS
强制重启pod
Label
测试环境管理
service+deployment+ingress+hpa
networking.k8s.io/v1
k3s
k3s脚本快速安装
k3s卸载
k3s-containerd仓库配置
rookceph
1. 安装配置
2. 管理排障
k8s中查看rookceph控制台admin密码
k3s-启用traefik仪表盘
helm
Chartmuseum
artifact hub
Helm内置对象Release相关变量
96.Ingress
ingress-nginx-annotations
97.CKA认证
98.Kubernetes开发
本文档使用 MrDoc 发布
-
+
首页
k3s脚本快速安装
# k3s脚本快速安装 为了快速部署测试环境用于测试一些开源中间件或系统,所以安装k3s作为测试环境。 ## 环境要求 ```shell # 系统内核版本:Linux 3.10+ (CentOS 7, Debian 8/9, Ubuntu 14.04+) # K3S Server端最低内存要求:512 MB # K3S Agent端内存最低要求:75MB # 磁盘空间最低要求:200 MB # 支持的硬件架构:x86_64, ARMv7, ARM64 ``` ## 安装配置 ### hostname设置 ```shell [root@centos-001 ~] hostnamectl set-hostname centos-001 # 主机名必需唯一,否则客户端可能加入不到server端 ``` ### server安装 ```shell [root@centos-001 ~] curl https://releases.rancher.com/install-docker/19.03.sh | sh [root@centos-001 ~] curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh |INSTALL_K3S_VERSION=v1.20.14+k3s1 INSTALL_K3S_MIRROR=cn K3S_DATASTORE_ENDPOINT=etcd sh -s - --docker --etcd-expose-metrics=true # 会作为一个systemd服务运行, 支持开机自启动 # 会安装额外的工具,包括kubectl, crictl, ctr, k3s-killall.sh和k3s-uninstall.sh # 会生成kubeconfig配置文件/etc/rancher/k3s/k3s.yaml ``` ### token查看 ```shell [root@centos-001 ~]# cat /var/lib/rancher/k3s/server/node-token K108892464b33a36f78370d10085c86a960e3d5bf56a4304acab9b08ef10968a221::server:de73cbbbd324bbe4d98e693b0c11883f # 该token用于Agent安装时候,传递给K3S_TOKEN参数 ``` ### agent安装 ```shell [root@centos-002 ~] curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | K3S_URL=https://10.20.205.178:6443 K3S_TOKEN=${TOKEN} INSTALL_K3S_VERSION=v1.20.14+k3s1 INSTALL_K3S_MIRROR=cn sh -s - --docker # K3S_URL是Server节点的IP地址, 默认端口是6443 # K3S_TOKEN存储在Server节点的/var/lib/rancher/k3s/server/node-token文件中 [root@centos-001 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION centos-001 Ready control-plane,etcd,master 4m7s v1.20.7+k3s1 centos-002 NotReady <none> 33s v1.20.7+k3s1 # 给节点打worker标签 [root@centos-001 ~]# kubectl label node centos-002 node-role.kubernetes.io/worker=worker [root@centos-001 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION centos-001 Ready control-plane,etcd,master 4m7s v1.20.7+k3s1 centos-002 Ready worker 33s v1.20.7+k3s1 ``` ## 使用 ### agent端查看服务 ```shell [root@centos-001 ~] systemctl status k3s-agent # 如果显示Active: active (running),则表示客户端正常 ``` ![](/media/202106/2021-06-03_160710.png) ### server端查看服务 ```shell [root@centos-001 ~] kubectl get nodes NAME STATUS ROLES AGE VERSION centos-001 Ready control-plane,master 25h v1.20.7+k3s1 centos-002 Ready worker 25h v1.20.7+k3s1 # 能够查询到centos--01和centos-002分别为master和worker ``` ### 常用命令 ```shell # 验证客户端是否安装成功 [root@centos-002 ~] systemctl status k3s-agent # 验证服务端是否安装成功 [root@centos-001 ~] kubectl get nodes # agent端重启 [root@centos-002 ~] service k3s-agent restart # 检查pod状态 [root@centos-001 ~] k3s kubectl get po --all-namespaces # 重启k3s服务 [root@centos-001 ~] systemctl restart k3s # 查看k3s状态 [root@centos-001 ~] systemctl status k3s ```
zhangky
2022年1月10日 13:03
分享文档
收藏文档
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码