一、下载kops
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops
二、安装aws-iam-authenticator
-
从 Amazon S3 中下载 Amazon EKS 提供的
aws-iam-authenticator
二进制文件。curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator
-
(可选)使用同一存储桶前缀中提供的 SHA-256 总和验证下载的二进制文件。
-
下载系统的 SHA-256 总和。要下载 Arm 版本,请先将
<amd64>
更改为arm64
,然后再运行相应命令。curl -o aws-iam-authenticator.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator.sha256
-
检查下载的二进制文件的 SHA-256 总和。
openssl sha1 -sha256 aws-iam-authenticator
-
将命令输出中生成的 SHA-256 总和与下载的
aws-iam-authenticator.sha256
文件进行比较。这两者应该匹配。
-
-
将执行权限应用于二进制文件。
chmod +x ./aws-iam-authenticator
-
将二进制文件复制到您的
$PATH
中的文件夹。我们建议创建一个$HOME/bin/aws-iam-authenticator
并确保$HOME/bin
首先显示在您的$PATH
中。mkdir -p $HOME/bin && cp ./aws-iam-authenticator $HOME/bin/aws-iam-authenticator && export PATH=$PATH:$HOME/bin
-
将
$HOME/bin
添加到PATH
环境变量。echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
-
测试
aws-iam-authenticator
二进制文件的工作原理。aws-iam-authenticator help
三、创建密钥对
需要在机器中自签密钥对,用于连接创建后的集群。
ssh-keygen
kops create secret --name ${KOPS_CLUSTER_NAME} sshpublickey admin -i ~/.ssh/id_rsa.pub
kops update