跳至内容

Kops 创建密钥对

kops create keypair

将 CA 证书和私钥添加到密钥集中。

概要

将 CA 证书和私钥添加到密钥集中。

如果既没有提供证书也没有提供私钥,则将生成新的自签名证书和私钥。

如果未提供证书但提供了私钥,则将根据提供的私钥生成自签名证书。

如果提供了证书但没有提供私钥,则证书将被添加到密钥集中,而不会有私钥。这样的证书不能设为主证书。

每个密钥集中必须有一个证书/私钥对为主密钥对。主密钥对用于颁发证书(或对于“service-account”密钥集,则用于服务帐户令牌)。因此,添加到空密钥集的密钥对必须设为主密钥对。

如果密钥集指定为“all”,则新生成的辅助证书和私钥将被添加到每个可轮换密钥集中。

kops create keypair {KEYSET | all} [flags]

示例

  # Add a CA certificate and private key to a keyset.
  kops create keypair kubernetes-ca \
  --cert ~/ca.pem --key ~/ca-key.pem \
  --name k8s-cluster.example.com --state s3://my-state-store

  # Add a newly generated certificate and private key to each rotatable keyset.
  kops create keypair all \
  --name k8s-cluster.example.com --state s3://my-state-store

选项

      --cert string   Path to CA certificate
  -h, --help          help for keypair
      --key string    Path to CA private key
      --primary       Make the keypair the one used to issue certificates

从父命令继承的选项

      --config string   yaml config file (default is $HOME/.kops.yaml)
      --name string     Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable
      --state string    Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable
  -v, --v Level         number for the log level verbosity

另请参阅

  • kops create - 通过命令行、文件名或标准输入创建资源。