• 欢迎访问蜷缩的蜗牛博客 蜷缩的蜗牛
  • 微信搜索: 蜷缩的蜗牛 | 联系站长 kbsonlong@qq.com
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

kubectl create secret docker-registry

kubectl命令表 蜷缩的蜗牛 3个月前 (06-20) 24次浏览 已收录

kubectl create secret docker-registry

创建与 Docker registries 一起使用的 secret。

Dockercfg secrets 用于对 Docker registries 进行安全认证。

当使用 Docker 命令 push 镜像时,可以进行 Docker registries 认证

$ docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'.

这时会产生一个 ~/.dockercfg 文件,在“docker push”和“docker pull”命令时,此文件用于 registries 进行认证。

在创建应用时,当Node节点从私有仓库 Pull 镜像时,需要有相应凭证,才能使用私有 Docker 仓库。我们可以通过创建 dockercfg secret 并添加到service account来实现。

语法

$ docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-literal=key1=value1] [--dry-run]

示例

如果没有.dockercfg 文件,则可以使用以下命令创建 dockercfg secret:

kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL

Flags

Name Shorthand Default Usage
allow-missing-template-keys true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
docker-email Email for Docker registry
docker-password Password for Docker registry authentication
docker-server https://index.docker.io/v1/ Server location for Docker registry
docker-username Username for Docker registry authentication
dry-run false If true, only print the object that would be sent, without sending it.
generator secret-for-docker-registry/v1 The name of the API generator to use.
include-extended-apis true If true, include definitions of new APIs via calls to the API server. [default true]
no-headers false When using the default or custom-column output format, don’t print headers (default print headers).
output o Output format. One of: json|yaml|wide|name|custom-columns=…|custom-columns-file=…|go-template=…|go-template-file=…|jsonpath=…|jsonpath-file=… See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
output-version DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: ‘jobs.v1.batch/myjob’).
save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
schema-cache-dir ~/.kube/schema If non-empty, load/store cached API schemas in this directory, default is ‘$HOME/.kube/schema’
show-all a false When printing, show all resources (default hide terminated pods.)
show-labels false When printing, show all labels as the last column (default hide labels column)
sort-by If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. ‘{.metadata.name}’). The field in the API resource specified by this JSONPath expression must be an integer or a string.
template Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
validate true If true, use a schema to validate the input before sending it
K8S 中文社区微信公众号

本文转载自 kubectl create secret docker-registry


蜷缩的蜗牛 , 版权所有丨如未注明 , 均为原创丨 转载请注明kubectl create secret docker-registry
喜欢 (0)
[]
分享 (0)