markdown Kubernetes:从私人仓库中提取图片

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Kubernetes:从私人仓库中提取图片相关的知识,希望对你有一定的参考价值。

based on [kubernetes official documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)
## Log in docker
`$ docker login`

The login process creates or updates a config.json file that holds an authorization token.

View the `config.json` file:
`$ cat ~/.docker/config.json`

## Create a Secret based on existing Docker credentials
copy credential into Kubernetes
```
$ kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \
    --type=kubernetes.io/dockerconfigjson
```

## Create a Secret by providing credentials on the command line
Create this Secret, naming it `regcred`:
```
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> \
  --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
```
- `<your-registry-server>` is your Private Docker Registry FQDN. (https://index.docker.io/v1/ for DockerHub)
- `<your-name>` is your Docker username.
- `<your-pword>` is your Docker password.
- `<your-email>` is your Docker email.
 
## Create a Pod that uses your Secret
Here is a configuration file for a Pod that needs access to your Docker credentials in `regcred`
``` yml
apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: <your-private-image>
\!h  imagePullSecrets:
\!h  - name: regcred
```

以上是关于markdown Kubernetes:从私人仓库中提取图片的主要内容,如果未能解决你的问题,请参考以下文章

Kubernetes简易部署!

Kubernetes简易部署!

Kubernetes简易部署!

k8s部署Eureka和Seata_2020.05.28

创建docker私人仓库

如何打造自己的私人知识库