1 Star 2 Fork 3

个人开源 / mldong-devops-vue-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
k8s.yaml 3.66 KB
一键复制 编辑 原始数据 按行查看 历史
mldong 提交于 2022-06-05 13:00 . 资源大小
apiVersion: v1
kind: ConfigMap
metadata:
namespace: mldong-test
name: mldong-devops-vue-demo-nginx-configmap
data:
nginx_conf: |-
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /api/ {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://mldong-devops-demo:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
---
apiVersion: v1
kind: Service
metadata:
name: mldong-devops-vue-demo
namespace: mldong-test
spec:
type: ClusterIP
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: mldong-devops-vue-demo
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mldong-devops-vue-demo
namespace: mldong-test
spec:
selector:
matchLabels:
app: mldong-devops-vue-demo
replicas: 1
template:
metadata:
labels:
app: mldong-devops-vue-demo
spec:
containers:
- name: mldong-devops-vue-demo
image: ${docker_url}
imagePullPolicy: IfNotPresent
# imagePullPolicy: Always
ports:
- containerPort: 80
name: port
protocol: TCP
readinessProbe: # 就续探针-可对外服务
httpGet:
path: /index.html
port: 80
initialDelaySeconds: 5 #第一次健康检查的时间
periodSeconds: 5 #检查周期
timeoutSeconds: 3 #检查超时时间
successThreshold: 1 #成功次数判定成功
failureThreshold: 3 #失败次数判定失败
lifecycle:
preStop:
exec:
command: ["nginx", "-s", "quit"] # 让 pod 真正销毁前先 优雅退出,执行完当前的请求后退出
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 1000m
memory: 1Gi
volumeMounts:
- mountPath: /etc/nginx/nginx.conf
name: pvc-mldong-devops-vue-demo-nginx-configmap
subPath: nginx.conf
volumes:
- name: pvc-mldong-devops-vue-demo-nginx-configmap
configMap:
name: mldong-devops-vue-demo-nginx-configmap
items:
- key: nginx_conf
path: nginx.conf
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mldong-devops-vue-demo-ingress
namespace: mldong-test
spec:
rules:
- host: vue.mldong.top
http:
paths:
- backend:
service:
name: mldong-devops-vue-demo
port:
number: 80
path: /
pathType: ImplementationSpecific
1
https://gitee.com/mldong/mldong-devops-vue-demo.git
git@gitee.com:mldong/mldong-devops-vue-demo.git
mldong
mldong-devops-vue-demo
mldong-devops-vue-demo
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891