Create an SSH key pair

To enable encrypted communications with your cluster, you must create an asymmetric key pair (a public and a private key) and associate it with your control plane or node pool virtual machines.

To generate an asymmetric key pair, run the following command:

ssh-keygen -t rsa -m PEM -b 4096 -C "COMMENT" \
    -f SSH_PRIVATE_KEY -N "" 1>/dev/null

Replace the following:

  • SSH_PRIVATE_KEY: a file name to save the key in
  • COMMENT: a text string describing the key

This creates two files: SSH_PRIVATE_KEY containing your SSH private key, and SSH_PRIVATE_KEY.pub containing the corresponding public key.

To save your SSH public key into an environment variable, run the following command:

SSH_PUBLIC_KEY=$(cat SSH_PRIVATE_KEY.pub)

What's next