我在EC2实例上部署了一个2节点K8S群集。我使用RKE来部署集群(而不是kube-up),并且我尝试将AWS EB卷用作K8S持久卷。创建的卷和实例位于同一区域(us-east-2)。
我将k8s用户配置为通过CLI访问aws,甚至导出特定的AWS变量:AWS_ACCESS_KEY_ID和AWS_SECRET_ACCESS_KEY
当我尝试创建PV(kubectl create -f aws-persistent-volume.yml
)时,我总是得到:
Error from server (Forbidden): error when creating "aws-persistent-volume.yml": persistentvolumes "minio-volume" is forbidden: error querying AWS EBS volume vol-xxx: error finding instance i-xxx: "error listing AWS instances: \"NoCredentialProviders: no valid providers in chain. Deprecated. \\n\\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors\""
我的PV YML文件如下:
kind: PersistentVolume
apiVersion: v1
metadata:
name: minio-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
awsElasticBlockStore:
volumeID: vol-xxx
fsType: ext4
列出卷(aws --region us-east-2 ec2 describe-volumes --volume-id vol-xxx
)没有问题:
{
"Volumes": [
{
"AvailabilityZone": "us-east-2a",
"Attachments": [],
"Encrypted": false,
"VolumeType": "gp2",
"VolumeId": "vol-xxx",
"State": "available",
"Iops": 100,
"SnapshotId": "",
"CreateTime": "2018-04-23T14:17:22.563Z",
"Size": 10
}
]
}
其他信息:OS Centos 7,Kubernetes v1.8.3
有任何帮助吗? 提前谢谢。