为kubernetes(k8s)单独配置kubectl工具
介绍
Kubernetes API 是一个 HTTP REST API。这个 API 是真正的 Kubernetes 用户界面,通过它可以完全控制它。这意味着每个 Kubernetes 操作都作为 API 端点公开,并且可以通过对该端点的 HTTP 请求进行。因此,kubectl 的主要目的是向 Kubernetes API 发出 HTTP 请求:
配置apt软件源
root@hello:~# apt-get update && apt-get install -y apt-transport-https
Hit:1 http://192.168.1.104:81/ubuntu focal InRelease
Hit:2 http://192.168.1.104:81/ubuntu focal-security InRelease
Hit:3 http://192.168.1.104:81/ubuntu focal-updates InRelease
Hit:4 http://192.168.1.104:81/ubuntu focal-proposed InRelease
Hit:5 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (2.0.6).
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
root@hello:~#
root@hello:~#
root@hello:~# curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2537 100 2537 0 0 26989 0 --:--:-- --:--:-- --:--:-- 26989
OK
root@hello:~#
root@hello:~# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
> deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
> EOF
root@hello:~# apt-get update
Hit:1 http://192.168.1.104:81/ubuntu focal InRelease
Hit:2 http://192.168.1.104:81/ubuntu focal-security InRelease
Hit:3 http://192.168.1.104:81/ubuntu focal-updates InRelease
Hit:4 http://192.168.1.104:81/ubuntu focal-proposed InRelease
Hit:5 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease
Get:6 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial InRelease [9,383 B]
Ign:7 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main amd64 Packages
Get:7 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main amd64 Packages [52.6 kB]
Fetched 62.0 kB in 1s (59.9 kB/s)
Reading package lists... Done
root@hello:~#使用apt安装kubectl工具
配置kubectl配置文件
*注意:配置文件中的server需要修改,并且该配置文件在原有的集权管理节点上。
配置自动补全,并测试kubectl
关于
https://www.oiox.cn/
https://www.oiox.cn/index.php/start-page.html
CSDN、GitHub、51CTO、知乎、开源中国、思否、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客
全网可搜《小陈运维》
文章主要发布于微信公众号
最后更新于