<p>I can't create a kubernetes cluster when using KOPS, the error message I get is: </p>

<p><code>error reading cluster configuration "fraxxxx-k8s-devopsxxx": error reading s3://devopsxxx-k8s-learn.s3.amazonaws.com/fraxxx-k8s-devopsbcn/config: Could not retrieve location for AWS bucket devopsxxx-k8s-learn.s3.amazonaws.com</code></p>

<p>I did create my s3 bucket, I though it was an issue like the bucket was not created, so I browsed my AWS bucket and it was in there.</p>

<p>Executing the command below always displays an error for me:</p>

<pre><code>$ sudo kops create cluster fraxxxx-k8s-devopsxxx --zones eu-west-3a --yes

error reading cluster configuration "fraxxxx-k8s-devopsxxx": error reading s3://devopsxxx-k8s-learn.s3.amazonaws.com/fraxxx-k8s-devopsbcn/config: Could not retrieve location for AWS bucket devopsxxx-k8s-learn.s3.amazonaws.com
</code></pre>

<p>I did configure my Access Keys:</p>

<pre><code>:~$ aws configure
AWS Access Key ID [****************IYFQ]: 
AWS Secret Access Key [****************+SXJ]: 
Default region name [eu-west-3]: 
Default output format [None]: 
</code></pre>

<p>Even exported the keys as an env vars:</p>

<pre><code>~$ echo $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY 
XXXXXXXXXXXXXXXIYFQ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+SXJ
</code></pre>

<p>The bucket name was exported as env var as well, and I double checked it via GUI and it seems fine.</p>

<pre><code>~$ echo $KOPS_STATE_STORE
s3://devxxxxxx-k8s-learn.s3.amazonaws.com
</code></pre>

<p>Executed it again the create command but now adding the "state" flag, and still it is failing.</p>

<pre><code>$ sudo kops create cluster fraxxxx-k8s-devxxxxx --zones eu-west-3a --yes --state s3://devxxxxxx-k8s-learn.s3.amazonaws.com

error reading cluster configuration "fraxxxx-k8s-devxxxxxx": error reading s3://devxxxxxx-k8s-learn.s3.amazonaws.com/fraxxxx-k8s-devopsbcn/config: Could not retrieve location for AWS bucket devopsbcn-k8s-learn.s3.amazonaws.com
</code></pre>

<p>I expect to run the create command and have a working kubernetes cluster.</p>

farp332
<p><strong><em>Answering to myself</em></strong>
As per AWS official documentation,after KOPS ver 1.6.1 you require:</p>

<p>1) Top level domain to create the kubernetes cluster.</p>

<p>2) IAM User with specific permission, because using the root AWS Secret Keys is complicated, or now limited.</p>

<p>I use these permission for my IAM user:</p>

<p><code>
AmazonEC2FullAccess
IAMFullAccess
AmazonEC2ContainerRegistryFullAccess
AmazonS3FullAccess
AWSElasticBeanstalkFullAccess
AmazonVPCFullAccess
AmazonRoute53FullAccess
</code></p>

<p>3) And of course you should use the Access Key and Secret from your IAM user.</p>

<p>4) Then an AWS route53 hosted zone. Steps in the link below</p>

<p>5) The "create" cluster command that worked for me:
<code>$ sudo kops create cluster --name cluster.kubernetes-aws.io --zones eu-west-3a --state s3://xxxxx-kops-state-store --master-size=t2.micro --yes</code></p>

<p>Mind the flags <code>--name</code> and <code>--state</code></p>

<p>Please use this documentation to accomplish the requirements above <code>https://aws.amazon.com/blogs/compute/kubernetes-clusters-aws-kops/</code></p>

<p>Beside those points listed above, I had to figure out few more things, like:</p>

<p>A) Adding my api DNS entry from my AWS route53 to <code>/etc/hosts</code>, i.e api.cluster.kubernetes-aws.io 32.56.87.41, Because when I ran this command <code>kops validate cluster</code>, it was trying to look locally on my PC for the cluster, see below:</p>

<p><strong>wrong</strong></p>

<p><code>
$ sudo kops validate cluster --name cluster.kubernetes-aws.io --state s3://xxxxx-kops-state-store
Validating cluster cluster.kubernetes-aws.io
unexpected error during validation: unable to resolve Kubernetes cluster API URL dns: lookup api.cluster.xxxxxxxxx.com on 127.0.0.53:53: no such host
</code></p>

<p><strong>right</strong></p>

<pre><code>$ sudo kops validate cluster --name cluster.kubernetes-aws.io --state s3://xxxxx-kops-state-store
[sudo] password for prometheus: 
Validating cluster cluster.kubernetes-aws.io

INSTANCE GROUPS
NAME            ROLE    MACHINETYPE MIN MAX SUBNETS
master-eu-west-3a   Master  t2.micro    1   1   eu-west-3a
nodes           Node    t2.medium   2   2   eu-west-3a

NODE STATUS
NAME                        ROLE    READY
ip-172-XX-XX-XX.eu-west-3.xxxxx.internal    master  True

VALIDATION ERRORS
KIND    NAME                            MESSAGE
Machine i-05755f2ba8b9ebea0                 machine "i-05755f2ba8b9ebea0" has not yet joined cluster
Machine i-05d0a12acf5434e26                 machine "i-05d0a12acf5434e26" has not yet joined cluster
Pod kube-system/kube-dns-57dd96bb49-q6zwc           kube-system pod "kube-dns-57dd96bb49-q6zwc" is pending
Pod kube-system/kube-dns-autoscaler-867b9fd49d-hgpf8    kube-system pod "kube-dns-autoscaler-867b9fd49d-hgpf8" is pending
</code></pre>

<p>B) Again mind the flags <code>--name</code> and <code>--state</code> when trying to validate the cluster, otherwise you get errors.</p>

<p>C) Important, when creating the cluster, you have to add the machine type otherwise you get the error below.</p>

<p><code>error assigning default machine type for masters: error finding default machine type: could not find a suitable supported instance type for the instance group "master-eu-west-3a" (type "Master") in region "eu-west-3"</code></p>

<p>D) My s3 bucket was not being picked from the env vars (or something like that), and I just passed it as flag with <code>--state</code>. For point C and D I created the cluster succesfully as follows:</p>

<p><code>$ sudo kops create cluster --name cluster.kubernetes-aws.io --zones eu-west-3a --state s3://xxxxx-kops-state-store --master-size=t2.micro --yes</code></p>
