我正在按照https://github.com/kubernetes/kops/blob/master/docs/cli/kops_create_cluster.md这些说明通过kops创建集群

这就是我尝试过的

export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
export KOPS_CLUSTER_NAME=staging.fayzlab.com
export KOPS_STATE_STORE=s3://fayzlab-kops-stat-store

aws s3api create-bucket \
--bucket fayzlab-kops-stat-store \
--region us-east-1

aws s3api put-bucket-versioning --bucket fayzlab-kops-stat-store --versioning-configuration Status=Enabled

kops create cluster \
    --zones us-east-1b \
    --topology private \
    --networking calico \
    --api-ssl-certificate arn:aws:acm:us-east-1:679995182974:certificate/b1753864-f1b7-4a51-a008-cb14f07544ab \
    --master-size t2.micro\
    --master-count 1 \
    --node-size t2.micro \
    --node-count 1 \
    --name ${KOPS_CLUSTER_NAME}

我得到以下输出
{
    "Location": "/fayzlab-kops-stat-store"
}
I0329 17:58:56.299037   32539 create_cluster.go:496] Inferred --cloud=aws from zone "us-east-1b"
I0329 17:58:57.216939   32539 subnets.go:184] Assigned CIDR 172.20.32.0/19 to subnet us-east-1b
I0329 17:58:57.217040   32539 subnets.go:198] Assigned CIDR 172.20.0.0/22 to subnet utility-us-east-1b
Previewing changes that will be made:


SSH public key must be specified when running with AWS (create with `kops create secret --name staging.fayzlab.com sshpublickey admin -i ~/.ssh/id_rsa.pub`)

我创建了一个密钥ssh-keygen -t rsa -f ./cluster.fayzlab.com
并尝试
kops create secret sshpublickey admin -i ~/.ssh/cluster.fayzlab.com.pub \
  --name staging.fayzlab.com --state s3://fayzlab-kops-stat-store

但我收到此错误
error reading SSH public key /home/faiz/.ssh/cluster.fayzlab.com.pub: open /home/faiz/.ssh/cluster.fayzlab.com.pub: permission denied

我已经用尽了所有在线选择和资源。请指教。

文件权限
-rw------- 1 faiz faiz 1766 Mar 29 17:51 cluster.fayzlab.com
-rw-r--r-- 1 faiz faiz  391 Mar 29 17:51 cluster.fayzlab.com.pub

最佳答案

选项一

1)将工作目录更改为

cd ~/.ssh/

2)并再次如下运行命令
kops create secret sshpublickey admin -i cluster.fayzlab.com.pub --name staging.fayzlab.com --state s3://fayzlab-kops-stat-store

方案二

提供您的公钥的完整路径,即
kops create secret sshpublickey admin -i /home/faiz/.ssh/cluster.fayzlab.com.pub --name staging.fayzlab.com --state s3://fayzlab-kops-stat-store

关于amazon-web-services - kops ssh公开 key 权限被拒绝,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55419161/

10-16 17:03