Search code examples
amazon-web-serviceskuberneteskops

Define custom SSH key or find autogenerated SSH key in KOPs


I'm using KOPs to launch a Kubernetes cluster in the AWS environment.

  1. Is there a way to set a predefined SSH key when calling create cluster?
  2. If KOPs autogenerates the SSH key when running create cluster, is there a way to download this key to access the cluster nodes?

Solution

  • Please read the Kops SSH docs:

    When using the default images, the SSH username will be admin, and the SSH private key is be the private key corresponding to the public key in kops get secrets --type sshpublickey admin. When creating a new cluster, the SSH public key can be specified with the --ssh-public-key option, and it defaults to ~/.ssh/id_rsa.pub.

    So to answer your questions:

    1. Yes, you can set the key using --ssh-public-key
    2. When --ssh-public-key is not specified Kops does not autogenerate a key, but rather uses the key found in ~.ssh/id_rsa.pub