apiVersion: apps/v1 kind: Deployment metadata: labels: app: dailylove name: dailylove namespace: my-proj #一定要写名称空间 spec: progressDeadlineSeconds: 600 replicas: 1 selector: matchLabels: app: dailylove strategy: rollingUpdate: maxSurge: 50% maxUnavailable: 50% type: RollingUpdate template: metadata: labels: app: dailylove spec: imagePullSecrets: - name: aliyun-docker-hub #提前在项目下配置访问阿里云的账号密码 containers: - image: $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$TAG readinessProbe: httpGet: path: / port: 8080 timeoutSeconds: 10 failureThreshold: 30 periodSeconds: 5 imagePullPolicy: Always name: app ports: - containerPort: 13145 protocol: TCP resources: limits: cpu: 300m memory: 120Mi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always terminationGracePeriodSeconds: 30 --- apiVersion: v1 kind: Service metadata: labels: app: dailylove name: dailylove namespace: my-proj spec: ports: - name: http port: 13146 protocol: TCP targetPort: 13146 selector: app: dailylove sessionAffinity: None type: ClusterIP --- apiVersion: v1 kind: ServiceAccount metadata: name: dailylove # ServiceAccount的名字 namespace: my-proj # serviceaccount的namespace labels: app: dailylove #ServiceAccount的标签