I have a 2 node K8S cluster deployed on EC2 instances. I used RKE to deploy the cluster (not kube-up), and I'm trying to use an AWS EB Volume as K8S Persistent volume. Created volume and instances are in the same region (us-east-2).
I configured k8s user to access aws through CLI and even exported specific AWS variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
When I try to create the PV ( kubectl create -f aws-persistent-volume.yml
)I always get:
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\""
My PV YML file is the following:
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
Listing volumes (aws --region us-east-2 ec2 describe-volumes --volume-id vol-xxx
) gives no problems:
{
"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
}
]
}
Additional informations: OS Centos 7, Kubernetes v1.8.3
Any help? Thanks in advance.