k3d安装k3s

安装kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

安装k3d

curl -s https://raw.githubusercontent.com/rancher/k3d/master/install.sh | bash

# 单master
k3d create
export KUBECONFIG=$(k3d get-kubeconfig)
# 集群1master +2 worker
k3d create  rancher/k3s:v1.0.0  --workers 2
export KUBECONFIG=$(k3d get-kubeconfig)

如果重复操作,注意删除$(k3d get-kubeconfig)所指向的config秘钥配置。