diff --git a/deploy/production/deployment.yaml b/deploy/production/deployment.yaml new file mode 100644 index 00000000..74c292b3 --- /dev/null +++ b/deploy/production/deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: data-frontend + name: data-frontend + namespace: zhishuyun +spec: + replicas: 2 + revisionHistoryLimit: 5 + selector: + matchLabels: + app: data-frontend + template: + metadata: + labels: + app: data-frontend + spec: + containers: + - image: ghcr.io/zhishuyun/data-frontend:${TAG} + name: data-frontend + ports: + - containerPort: 80 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 30 + periodSeconds: 5 + failureThreshold: 3 + timeoutSeconds: 10 + resources: + requests: + memory: '50Mi' + cpu: '10m' + limits: + memory: '100Mi' + cpu: '30m' + imagePullSecrets: + - name: docker-registry + restartPolicy: Always diff --git a/deploy/production/ingress.yaml b/deploy/production/ingress.yaml new file mode 100644 index 00000000..cbbcca39 --- /dev/null +++ b/deploy/production/ingress.yaml @@ -0,0 +1,22 @@ +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: data-frontend + namespace: zhishuyun + annotations: + kubernetes.io/ingress.class: 'nginx' + nginx.ingress.kubernetes.io/ssl-redirect: 'true' + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + tls: + - hosts: + - data.zhishuyun.com + secretName: tls-wildcard-zhishuyun-com + rules: + - host: data.zhishuyun.com + http: + paths: + - backend: + serviceName: data-frontend + servicePort: 8083 + path: / diff --git a/deploy/production/scripts/deploy.sh b/deploy/production/scripts/deploy.sh new file mode 100644 index 00000000..d3bf4c7f --- /dev/null +++ b/deploy/production/scripts/deploy.sh @@ -0,0 +1,3 @@ +cat deploy/production/deployment.yaml | sed 's/\${TAG}/'"$BUILD_NUMBER"'/g' | kubectl apply -f - || true +kubectl apply -f deploy/production/service.yaml +kubectl apply -f deploy/production/ingress.yaml \ No newline at end of file diff --git a/deploy/production/service.yaml b/deploy/production/service.yaml new file mode 100644 index 00000000..1bec6f71 --- /dev/null +++ b/deploy/production/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: data-frontend + name: data-frontend + namespace: zhishuyun +spec: + ports: + - name: '8083' + port: 8083 + targetPort: 80 + selector: + app: data-frontend