创建docker 私有仓库密钥
kubectl create secret docker-registry 密钥名称 --docker-server=你的仓库地址 --docker-username=仓库用户名 --docker-password=你的仓库密码 --docker-email=你的邮箱地址 --namespace=命名空间
示例:
kubectl create secret docker-registry harbor --docker-server=docker.jiangmingtao.com --docker-username=jiangmingtao --docker-password=123456.@az.654321 --docker-email="jiangmingtao@email.jiangmingtao.com" --namespace=master
deploymen中使用:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-service-deployment
namespace: master
labels:
app: my-service
spec:
#容器启动成功后 等待指定n秒后提供服务
minReadySeconds: 15
# RS历史版本保存数量
revisionHistoryLimit: 10
replicas: 2
selector:
matchLabels:
app: my-service
template:
metadata:
labels:
app: my-service
spec:
imagePullSecrets:
- name: harbor #指定密钥名称
containers:
- name: my-service
image: docker.jiangmingtao.com/master/my-service
imagePullPolicy: Always
resources:
limits:
cpu: "1"
memory: "1024Mi"
requests:
cpu: "0.5"
memory: "512Mi"
env:
- name: JAVA_OPTS
value: "-Xmx512m -XX:MetaspaceSize=256m -Xss256k -Dmy_server_name=my-service -Dmy-config.server-addr=127.0.9.1:8848 -Dmy-config.namespace=master"
ports:
- containerPort: 9999
volumeMounts:
- name: data-path
mountPath: /data
volumes:
- name: data-path
hostPath:
path: /data
上次更新时间 13 3 月, 2023 at 09:59 上午