简体   繁体   中英

Import manually created K8s cluster into KOps

It's been sometime I've visited all the web pages carrying word "KOps import" but did not find a way to import my manually created K8s cluster. Manually created cluster means " Deployed Infra on AWS using Terraform and Kubernetes using Terraform's provisioner script as Shell script ". Now as I see managing the environment manually is a pain, I look forward to move it under KOps. For that I have done the following so far:

  1. Installed aws cli , kubectl and kops in my local machine.

  2. Created KOps user with policies AmazonEC2FullAccess , AmazonRoute53FullAccess , AmazonS3FullAccess , IAMFullAccess , AmazonVPCFullAccess and generated access and secret keys.

  3. Configured credentials using aws configure .

  4. Created S3 bucket to store state.

  5. Set env variables like Region and Cluster name.

  6. Finally, ran kops import command as below:

    kops import cluster --region ${REGION} --name ${OLD_NAME}

But encountered below error:

Cluster.kops "jjm-prod-use1-kubernetes" not found

Verbosed:

$ kops import cluster --region ${REGION} --name ${OLD_NAME} -v 10
I0131 16:32:12.059651   25683 factory.go:68] state store s3://kops-state-store-jjm
I0131 16:32:13.133145   25683 s3context.go:194] found bucket in region "us-east-1"
I0131 16:32:13.133174   25683 s3fs.go:220] Reading file "s3://kops-state-store-jjm/jjm-prod-use1-kubernetes/config"

Which made me serious about posting this question. Is there any possible way where a K8s cluster created except using kubeup.sh can be brought under the control of KOps ? Please advise.

Note: There's no way I can re-create (destroy and create) the clusters as they are running in production.

EDIT: I know this can be achieved only the cluster was setup using kubeup.sh. But is there any other way ?

That is only possible with cluster bootstrapped via kube-up.sh script as officialy announced in Kops documentation pages. Actually, kube-up.sh has been excluded from the list of supported Kubernetes installation tools for AWS. Although, cluster composed by kube-up.sh provides a lot of customization settings which are specifically applicable to AWS, the initial script uses environmental variables to define these settings. Therefore, I assume that it's quite hard to achieve in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM