|
|
@@ -2,25 +2,25 @@ kind: Deployment |
|
|
|
apiVersion: apps/v1 |
|
|
|
# 元数据 |
|
|
|
metadata: |
|
|
|
name: egg-admin |
|
|
|
name: egg-app |
|
|
|
namespace: egg |
|
|
|
labels: |
|
|
|
app: egg-admin |
|
|
|
app: egg-app |
|
|
|
annotations: |
|
|
|
kubesphere.io/creator: dengbiao |
|
|
|
kubesphere.io/description: egg-admin |
|
|
|
kubesphere.io/description: egg-app |
|
|
|
# deployment主要部分 |
|
|
|
spec: |
|
|
|
replicas: 1 |
|
|
|
selector: |
|
|
|
matchLabels: |
|
|
|
# 名称与上面的labels对应 |
|
|
|
app: egg-admin |
|
|
|
app: egg-app |
|
|
|
template: |
|
|
|
metadata: |
|
|
|
labels: |
|
|
|
# 名称与上面的matchLabels对应 |
|
|
|
app: egg-admin |
|
|
|
app: egg-app |
|
|
|
spec: |
|
|
|
# 声明挂载卷(将外部已存在的pvc、config等挂载进来) |
|
|
|
volumes: |
|
|
@@ -30,61 +30,31 @@ spec: |
|
|
|
path: /etc/localtime |
|
|
|
type: '' |
|
|
|
# 将前面创建的configMap也挂载进来 |
|
|
|
- name: egg-admin-cfg |
|
|
|
- name: egg-app-cfg |
|
|
|
configMap: |
|
|
|
# 这里的名字就是前面创建的configMap的名字 |
|
|
|
name: egg-admin-cfg |
|
|
|
name: egg-app-cfg |
|
|
|
defaultMode: 420 |
|
|
|
# pvc |
|
|
|
- name: egg-admin # 在该部署中的名称,后面使用改名称挂载 |
|
|
|
persistentVolumeClaim: |
|
|
|
claimName: egg-admin # pvc的名称 |
|
|
|
# Nginx配置 |
|
|
|
- name: egg-admin-nginx |
|
|
|
configMap: |
|
|
|
name: egg-admin-nginx # 外部configMap的名称 |
|
|
|
items: |
|
|
|
- key: go.conf |
|
|
|
path: default.conf |
|
|
|
containers: |
|
|
|
# 主容器 |
|
|
|
- name: egg-admin-container |
|
|
|
- name: egg-app-container |
|
|
|
# 镜像地址(提前打包好并推送的镜像仓库) |
|
|
|
image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/egg-admin:0.0.1' |
|
|
|
image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/egg-app:0.0.1' |
|
|
|
ports: |
|
|
|
- name: egg-admin-4001 |
|
|
|
- name: egg-app-4011 |
|
|
|
# 容器端口号(注意与golang web server启动的端口一致) |
|
|
|
containerPort: 4001 |
|
|
|
containerPort: 4011 |
|
|
|
protocol: TCP |
|
|
|
# 将前面volume声明的需要用到的pvc、config挂载上来 |
|
|
|
volumeMounts: |
|
|
|
- name: host-time |
|
|
|
readOnly: true |
|
|
|
mountPath: /etc/localtime |
|
|
|
- name: egg-admin-cfg # 该名字对应前面volumes声明的名字 |
|
|
|
- name: egg-app-cfg # 该名字对应前面volumes声明的名字 |
|
|
|
readOnly: true |
|
|
|
# 挂载到容器的哪个路径 |
|
|
|
mountPath: /var/egg |
|
|
|
imagePullPolicy: Always |
|
|
|
# Nginx 容器 |
|
|
|
- name: nginx |
|
|
|
image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/nginx:latest' |
|
|
|
ports: |
|
|
|
- name: http-80 |
|
|
|
containerPort: 80 |
|
|
|
protocol: TCP |
|
|
|
volumeMounts: |
|
|
|
# 时区校正 |
|
|
|
- name: host-time |
|
|
|
readOnly: true |
|
|
|
mountPath: /etc/localtime |
|
|
|
# 存储卷 用于存放前端代码 |
|
|
|
- name: egg-admin # 前面volumes声明的名称 |
|
|
|
mountPath: /usr/share/nginx/html |
|
|
|
- name: egg-admin-nginx # Nginx 配置 |
|
|
|
readOnly: true |
|
|
|
mountPath: /etc/nginx/conf.d/default.conf |
|
|
|
subPath: default.conf |
|
|
|
restartPolicy: Always |
|
|
|
terminationGracePeriodSeconds: 30 |
|
|
|
dnsPolicy: ClusterFirst |