凌文龙
3 years ago
No known key found for this signature in database
GPG Key ID: 5BFEBF73ACCBF052
1 changed files with
71 additions and
0 deletions
-
devops/move2alirepositories.md
|
|
@ -83,3 +83,74 @@ docker push registry.cn-hangzhou.aliyuncs.com/fs-cloud/anxinyun-api:$IMAGE_VERSI |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 如何在项目中使用 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
由于现在镜像仓库设置成私有的,默认是无法拉取的, |
|
|
|
|
|
|
|
## 创建 secret |
|
|
|
|
|
|
|
```shell |
|
|
|
kubectl create secret docker-registry <secret-name> -n <命名空间> \ |
|
|
|
--docker-server=<你的镜像仓库服务器> \ |
|
|
|
--docker-username=<你的用户名> \ |
|
|
|
--docker-password=<你的密码> \ |
|
|
|
--docker-email=<你的邮箱地址> |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```shell |
|
|
|
kubectl create secret docker-registry registry-anxinyun-secret -n anxinyun \ |
|
|
|
--docker-server='registry.cn-hangzhou.aliyuncs.com' \ |
|
|
|
--docker-username='hi50040201@aliyun.com' \ |
|
|
|
--docker-password='V9rtCnt$f' |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 在yaml 文件中使用secret |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```yaml |
|
|
|
kind: Deployment |
|
|
|
apiVersion: apps/v1 |
|
|
|
metadata: |
|
|
|
name: api-anxincloud |
|
|
|
namespace: anxincloud |
|
|
|
labels: |
|
|
|
app: api-anxincloud |
|
|
|
spec: |
|
|
|
replicas: 3 |
|
|
|
selector: |
|
|
|
matchLabels: |
|
|
|
app: api-anxincloud |
|
|
|
template: |
|
|
|
metadata: |
|
|
|
labels: |
|
|
|
app: api-anxincloud |
|
|
|
spec: |
|
|
|
containers: |
|
|
|
- name: api-anxincloud |
|
|
|
image: registry.cn-hangzhou.aliyuncs.com/fs-cloud/anxinyun-web.api:179.21-12-15 |
|
|
|
command: |
|
|
|
- node |
|
|
|
- server.js |
|
|
|
ports: |
|
|
|
- name: http-8080 |
|
|
|
containerPort: 8080 |
|
|
|
protocol: TCP |
|
|
|
... |
|
|
|
... |
|
|
|
imagePullSecrets: |
|
|
|
- name: registry-anxinyun-secret |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|