deploy.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: xxx #名称,批量修改
namespace: quchengshi #命名空间,批量修改
spec:
replicas: 2 #指定Pod副本数
selector:
matchLabels:
app: xxx
template:
metadata:
labels:
app: xxx
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- xxx
topologyKey: kubernetes.io/hostname
weight: 1
containers:
- name: xxx
env:
- name: aliyun_logs_xxx
value: stdout
image: {{IMAGE_URL}}
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80 #服务端口,批量修改
protocol: TCP
resources:
requests:
memory: 400Mi
cpu: 5m
limits:
memory: 3000Mi
cpu: 2000m
restartPolicy: Always
imagePullSecrets:
- name: harbor
---
kind: Service
apiVersion: v1
metadata:
name: xxx
namespace: quchengshi
labels:
app: xxx
spec:
ports:
- name: tcp-80
protocol: TCP
port: 80
targetPort: 80
selector:
app: xxx
type: ClusterIP
Dockerfile:
FROM qw-prd-acr-registry.cn-shenzhen.cr.aliyuncs.com/quchengshi/nginx
EXPOSE 80
RUN rm -rf /usr/share/nginx/html/*
COPY dist/ /usr/share/nginx/html/
网友评论