k8s设置镜像创建
kubectl create secret docker-registry tencent-registry --docker-server=ccr.ccs.tencentyun.com --docker-username=100****807 --docker-password=pwdpwdpwd --docker-email=liuk@example.com -n default
- deployment中添加imagePullSecrets
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kanche-platform-gateway
labels:
app: kanche-platform-gateway
spec:
replicas: 1 #副本数量
selector:
matchLabels:
app: kanche-platform-gateway
template:
metadata:
labels:
app: kanche-platform-gateway
spec:
imagePullSecrets:
- name: tencent-registry
containers:
- name: kanche-platform-gateway
image: ccr.ccs.tencentyun.com/kanche/kanche-platform-gateway:1.0.2-tc-test
command: [ "top" ]
ports:
- containerPort: 80
name: http
protocol: TCP
resources:
requests:
cpu: 0.05
memory: 16Mi
limits:
cpu: 0.1
memory: 32Mi
设置环境变量
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kanche-platform-gateway
labels:
app: kanche-platform-gateway
spec:
replicas: 1 #副本数量
selector:
matchLabels:
app: kanche-platform-gateway
template:
metadata:
labels:
app: kanche-platform-gateway
spec:
containers:
- name: kanche-platform-gateway
env:
- name: app_name
value: "kanche-platform-gateway"
image: ccr.ccs.tencentyun.com/kanche/kanche-platform-gateway:1.0.2-tc-test
command: [ "top" ]
ports:
- containerPort: 80
name: http
protocol: TCP
resources:
requests:
cpu: 0.05
memory: 16Mi
limits:
cpu: 0.1
memory: 32Mi