This commit is contained in:
		@@ -52,4 +52,4 @@ jobs:
 | 
				
			|||||||
 
 | 
					 
 | 
				
			||||||
      - name: 部署到 Kubernetes
 | 
					      - name: 部署到 Kubernetes
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          kubectl apply -f /tmp/project/k8s/job.yaml
 | 
					          kubectl apply -f /k8s/app-deploy.yaml
 | 
				
			||||||
							
								
								
									
										36
									
								
								k8s/app-deploy.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								k8s/app-deploy.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					apiVersion: apps/v1
 | 
				
			||||||
 | 
					kind: Deployment
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: docs-app 
 | 
				
			||||||
 | 
					  namespace: app 
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  replicas: 2
 | 
				
			||||||
 | 
					  selector:
 | 
				
			||||||
 | 
					    matchLabels:
 | 
				
			||||||
 | 
					      app: docs 
 | 
				
			||||||
 | 
					  template:
 | 
				
			||||||
 | 
					    metadata:
 | 
				
			||||||
 | 
					      labels:
 | 
				
			||||||
 | 
					        app: docs 
 | 
				
			||||||
 | 
					    spec:
 | 
				
			||||||
 | 
					      imagePullSecrets:
 | 
				
			||||||
 | 
					      - name: my-aliyun
 | 
				
			||||||
 | 
					      containers:
 | 
				
			||||||
 | 
					        - name: docs 
 | 
				
			||||||
 | 
					          image: crpi-pqfsp88s5zx2zwfq.cn-hangzhou.personal.cr.aliyuncs.com/devstar/devstar_introduction:v1 
 | 
				
			||||||
 | 
					          ports:
 | 
				
			||||||
 | 
					            - containerPort: 80
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					kind: Service
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: docs-server-svc  
 | 
				
			||||||
 | 
					  namespace: app 
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  type: NodePort
 | 
				
			||||||
 | 
					  ports:
 | 
				
			||||||
 | 
					    - port: 80
 | 
				
			||||||
 | 
					      targetPort: 80
 | 
				
			||||||
 | 
					      nodePort: 31333
 | 
				
			||||||
 | 
					  selector:
 | 
				
			||||||
 | 
					    app: docs 
 | 
				
			||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
apiVersion: apps/v1
 | 
					 | 
				
			||||||
kind: Deployment
 | 
					 | 
				
			||||||
metadata:
 | 
					 | 
				
			||||||
  name: devstar-app
 | 
					 | 
				
			||||||
  namespace: devstar-deploy
 | 
					 | 
				
			||||||
spec:
 | 
					 | 
				
			||||||
  replicas: 3
 | 
					 | 
				
			||||||
  selector:
 | 
					 | 
				
			||||||
    matchLabels:
 | 
					 | 
				
			||||||
      app: devstar
 | 
					 | 
				
			||||||
  template:
 | 
					 | 
				
			||||||
    metadata:
 | 
					 | 
				
			||||||
      labels:
 | 
					 | 
				
			||||||
        app: devstar
 | 
					 | 
				
			||||||
    spec:
 | 
					 | 
				
			||||||
      containers:
 | 
					 | 
				
			||||||
        - name: devstar
 | 
					 | 
				
			||||||
          image: crp-pqf/sp885z2x2wfq.cn-hangzhou.personal.cr.aligunes.com/devstar/devstar_introduction:v1
 | 
					 | 
				
			||||||
          ports:
 | 
					 | 
				
			||||||
            - containerPort: 8889  # 容器监听端口
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
apiVersion: v1
 | 
					 | 
				
			||||||
kind: Service
 | 
					 | 
				
			||||||
metadata:
 | 
					 | 
				
			||||||
  name: devstar-server-svc  
 | 
					 | 
				
			||||||
  namespace: devstar-deploy
 | 
					 | 
				
			||||||
spec:
 | 
					 | 
				
			||||||
  type: NodePort
 | 
					 | 
				
			||||||
  ports:
 | 
					 | 
				
			||||||
    - port: 8889         
 | 
					 | 
				
			||||||
      targetPort: 8889    
 | 
					 | 
				
			||||||
      nodePort: 31234     
 | 
					 | 
				
			||||||
  selector:
 | 
					 | 
				
			||||||
    app: devstar          
 | 
					 | 
				
			||||||
							
								
								
									
										16
									
								
								k8s/job.yaml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								k8s/job.yaml
									
									
									
									
									
								
							@@ -1,16 +0,0 @@
 | 
				
			|||||||
apiVersion: batch/v1
 | 
					 | 
				
			||||||
kind: Job
 | 
					 | 
				
			||||||
metadata:
 | 
					 | 
				
			||||||
  name: todolist-job
 | 
					 | 
				
			||||||
spec:
 | 
					 | 
				
			||||||
  template:
 | 
					 | 
				
			||||||
    metadata:
 | 
					 | 
				
			||||||
      labels:
 | 
					 | 
				
			||||||
        app: todolist
 | 
					 | 
				
			||||||
    spec:
 | 
					 | 
				
			||||||
      restartPolicy: Never   # Job 通常不重启失败的 Pod,可以根据需求改为 OnFailure
 | 
					 | 
				
			||||||
      containers:
 | 
					 | 
				
			||||||
      - name: todolist-container
 | 
					 | 
				
			||||||
        image: crpi-s56ujsdigakae3xq.cn-hangzhou.personal.cr.aliyuncs.com/uniquespace/todolist:latest
 | 
					 | 
				
			||||||
        ports:
 | 
					 | 
				
			||||||
        - containerPort: 3000
 | 
					 | 
				
			||||||
@@ -1,47 +0,0 @@
 | 
				
			|||||||
apiVersion: apps/v1
 | 
					 | 
				
			||||||
kind: Deployment
 | 
					 | 
				
			||||||
metadata:
 | 
					 | 
				
			||||||
  name: zero-server
 | 
					 | 
				
			||||||
  namespace: zero-server
 | 
					 | 
				
			||||||
  labels:
 | 
					 | 
				
			||||||
    app: zero-server
 | 
					 | 
				
			||||||
spec:
 | 
					 | 
				
			||||||
  replicas: 3
 | 
					 | 
				
			||||||
  revisionHistoryLimit: 5
 | 
					 | 
				
			||||||
  selector:
 | 
					 | 
				
			||||||
    matchLabels:
 | 
					 | 
				
			||||||
      app: zero-server
 | 
					 | 
				
			||||||
  template:
 | 
					 | 
				
			||||||
    metadata:
 | 
					 | 
				
			||||||
      labels:
 | 
					 | 
				
			||||||
        app: zero-server
 | 
					 | 
				
			||||||
    spec:
 | 
					 | 
				
			||||||
      imagePullSecrets:
 | 
					 | 
				
			||||||
      - name: my-aliyun
 | 
					 | 
				
			||||||
      containers:
 | 
					 | 
				
			||||||
      - name: zero-server
 | 
					 | 
				
			||||||
        image: crpi-pqfsp88s5zx2zwfq.cn-hangzhou.personal.cr.aliyuncs.com/devstar/devstar_introduction:v1
 | 
					 | 
				
			||||||
        imagePullPolicy: IfNotPresent
 | 
					 | 
				
			||||||
        ports:
 | 
					 | 
				
			||||||
        - containerPort: 8889
 | 
					 | 
				
			||||||
        volumeMounts:
 | 
					 | 
				
			||||||
        - name: timezone
 | 
					 | 
				
			||||||
          mountPath: /etc/localtime
 | 
					 | 
				
			||||||
      volumes:
 | 
					 | 
				
			||||||
      - name: timezone
 | 
					 | 
				
			||||||
        hostPath:
 | 
					 | 
				
			||||||
          path: /usr/share/zoneinfo/Asia/Shanghai
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
apiVersion: v1
 | 
					 | 
				
			||||||
kind: Service
 | 
					 | 
				
			||||||
metadata:
 | 
					 | 
				
			||||||
  name: zero-server-svc
 | 
					 | 
				
			||||||
  namespace: zero-server
 | 
					 | 
				
			||||||
spec:
 | 
					 | 
				
			||||||
  ports:
 | 
					 | 
				
			||||||
  - port: 8889
 | 
					 | 
				
			||||||
    targetPort: 8889
 | 
					 | 
				
			||||||
    nodePort: 30115
 | 
					 | 
				
			||||||
  selector:
 | 
					 | 
				
			||||||
    app: zero-server
 | 
					 | 
				
			||||||
  type: NodePort
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user