Managing Key Pairs

Create, update or delete key pairs.

A key pair is stored as a Kubernetes Secret of type kubernetes.io/ssh-public-key; only the public key is kept — the platform never stores your private key. Key pairs are consumed when creating a virtual machine through Associated SSH Keys (injected via cloud-init).

Creating Key Pairs

  1. Navigate to Container Platform.

  2. In the left navigation bar, click Virtualization > Key Pairs.

  3. Click Create Key Pair.

    Currently, only SSH type key pairs are supported. You can manually import keys or let the system automatically generate a key pair. When using the system-generated key pair, the platform supports automatically downloading the private key to your local machine. The platform will not save the private key.

  4. Click Create.

Updating Key Pairs

  1. Navigate to Container Platform.

  2. In the left navigation bar, click Virtualization > Key Pairs.

  3. Locate the Key Pair Name, click ⋮ > Update.

  4. After re-importing or having the system generate a new key pair, click Update.

Deleting Key Pairs

  1. Navigate to Container Platform.

  2. In the left navigation bar, click Virtualization > Key Pairs.

  3. Locate the Key Pair Name, click ⋮ > Delete, and confirm.

Using the API

A key pair is a Secret of type kubernetes.io/ssh-public-key whose ssh-publickey value is the public key:

apiVersion: v1
kind: Secret
metadata:
  name: my-key
  namespace: demo
type: kubernetes.io/ssh-public-key
stringData:
  ssh-publickey: "ssh-ed25519 AAAA...example user@host"
kubectl apply -f keypair.yaml
kubectl get secret my-key -n demo -o jsonpath='{.type}{"\n"}'   # kubernetes.io/ssh-public-key
kubectl delete secret my-key -n demo

Reference the key when creating a virtual machine through Associated SSH Keys; the platform injects the public key into the guest via cloud-init ssh_authorized_keys.