typora/note/工具集/ubuntu安装kubectl.md
2024-12-12 10:48:55 +08:00

1.1 KiB

官网安装

推荐使用snap方式安装

1. 二进制包方式安装

1.1 下载二进制包

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

1.2 安装二进制包

sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

2.1 包管理器安装

2.1 必要组件安装

sudo apt-get update
sudo apt-get install -y ca-certificates curl

2.2 添加软件源

curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg

echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

2.3 更新软件源&&安装kubectl

sudo apt-get update
sudo apt-get install -y kubectl

3 snap包安装

sudo snap install kubectl --classic