跳至内容

Kops 创建 secret dockerconfig

kops 创建 secret dockerconfig

创建 Docker 配置。

概要

创建一个新的 Docker 配置并将其存储在状态存储中。用于在每个节点上配置 Docker 身份验证。

创建 dockerconfig 密钥后,将在新创建的节点中添加 /root/.docker/config.json 文件。Kubernetes 将使用此文件来对容器注册表进行身份验证。

当使用 containerd 作为容器运行时时,这同样适用。

kops create secret dockerconfig [CLUSTER] -f FILENAME [flags]

示例

  # Create a new Docker config.
  kops create secret dockerconfig -f /path/to/docker/config.json \
  --name k8s-cluster.example.com --state s3://my-state-store

  # Create a docker config via stdin.
  generate-docker-config.sh | kops create secret dockerconfig -f - \
  --name k8s-cluster.example.com --state s3://my-state-store

  # Replace an existing docker config secret.
  kops create secret dockerconfig -f /path/to/docker/config.json --force \
  --name k8s-cluster.example.com --state s3://my-state-store

选项

  -f, --filename string   Path to Docker config JSON file
      --force             Force replace the secret if it already exists
  -h, --help              help for dockerconfig

从父命令继承的选项

      --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

另请参阅