apiVersion: apps/v1 kind: Deployment metadata: labels: app: zhbaw-harbor name: zhbaw-harbor #一定要写名称空间 namespace: zhba spec: progressDeadlineSeconds: 600 replicas: 1 selector: matchLabels: app: zhbaw-harbor strategy: rollingUpdate: maxSurge: 50% maxUnavailable: 50% type: RollingUpdate template: metadata: labels: app: zhbaw-harbor spec: imagePullSecrets: - name: harbor #提前在项目下配置访问阿里云的账号密码 containers: - image: 192.168.0.191/zhbaw/zhbaw-harbor:SNAPSHOT-1 # - image: $REGISTRY/$DOCKERHUB_NAMESPACE/zhba:SNAPSHOT-$BUILD_NUMBER imagePullPolicy: Always name: zhbaw-harbor env: - name: JAVA_TOOL_OPTIONS value: -Xmx512m -Xms128m -Xmn32m -Xss16m ports: - containerPort: 81 protocol: TCP resources: limits: cpu: 300m memory: 600Mi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always terminationGracePeriodSeconds: 30 --- apiVersion: v1 kind: Service metadata: labels: app: zhbaw-harbor name: zhbaw-harbor namespace: zhba spec: ports: - name: http port: 81 protocol: TCP targetPort: 81 selector: app: zhbaw-harbor sessionAffinity: None type: ClusterIP