![cce架构设计](https://img.kancloud.cn/15/40/15405b67f434612b1cf3a586dd934195_2695x1118.png)
## cce-primary-X86 管理集群
POD IP:172.16.0.0/16
Service IP:IP:10.247.0./16
## CCE-ARM-Cluster 业务集群
POD IP:172.16.0.0/16
Service IP:10.247.0./16
## cce etcd 数据库备份
每日凌晨4点 备份数据库
cce-nfs-10.80.121.143
## 麒麟V10 ARM基础镜像dockerfile
基础镜像dockerfile存放在cce-arm-master01 主机:/root/dockerfile
### Java 基础镜像
Java version: openjdk- 1.8.0.342 默认包含APM 采集器
cce-xc-dev.hx168.com.cn/hx168-dev/kylin-server-10-sp2-aarch64-apm:1.0
```
FROM cce-xc-dev.hx168.com.cn/hx168-dev/kylin-server-10-sp2-aarch64:b09
RUN yum install -y java-1.8.0-openjdk vim-enhanced net-tools wget telnet zip unzip less \
&& yum clean all \
&& mkdir -p /opt/spring \
&& mkdir -p /volume_logs && ln -s /volume_logs /opt/spring/logs \
&& mkdir -p /volume_conf && ln -s /volume_conf /opt/spring/conf \
&& mkdir -p /volume_data && ln -s /volume_conf /opt/spring/data \
&& mkdir -p /opt/spring/ddagent
COPY dd-java-agent-1.17.0-guance.jar /opt/spring/ddagent
COPY locale.conf /etc/locale.conf
WORKDIR /opt/spring
EXPOSE 8080
```
### 前端nginx 基础镜像
nginx 基础镜像标准化定义access.log 日志格式
```
FROM cce-xc-dev.hx168.com.cn/hx168-dev/kylin-server-10-sp2-aarch64:b09
RUN yum install -y nginx gd-devel vim net-tools wget zip unzip less && \
yum clean all && \
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx","-g","daemon off;"]
```
## 前端业务镜像Dockerfile
```
FROM cce-xc-dev.hx168.com.cn/hx168-dev/kylin-nginx:1.21-2-new
COPY dist /usr/share/nginx/html # 静态资源复制到nginx root
```
## 后端业务镜像Dockerfile
```
FROM cce-xc-dev.hx168.com.cn/hx168-dev/kylin-openjdk-apm-utf8:1.8.0.342
COPY target/compass-alkaid-${{version}}.jar /opt/spring/app.jar
```
## 前端部署 Devployment
```
kind: Deployment
apiVersion: apps/v1
metadata:
name: alkaid-front-dev # Appid
namespace: compass-dev # 部署环境
spec:
replicas: 1
selector:
matchLabels:
app: alkaid-front-dev
template:
metadata:
labels:
app: alkaid-front-dev
spec:
containers:
- name: container-1688095380901
image: cce-xc-dev.hx168.com.cn/hx168-dev/alkaid-front:afde0e0
imagePullPolicy: Always
resources: # 资源限制
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
env: []
envFrom: []
volumeMounts:
- name: vol-1688096024316
readOnly: false
mountPath: /var/log/nginx/ # 标准化 nginx 日志采集路径
livenessProbe: # 健康检查地址
httpGet:
path: /check.html
port: 80
scheme: HTTP
timeoutSeconds: 1
initialDelaySeconds: 5
readinessProbe:
httpGet:
path: /check.html
port: 80
scheme: HTTP
initialDelaySeconds: 5
initContainers: []
imagePullSecrets:
- name: default-secret
volumes:
- name: vol-1688096024316
hostPath:
path: /opt/logs/alkaid-front-dev # 标准化nginx 映射路径
```
## 前端部署 Service
```
kind: Service
apiVersion: v1
metadata:
name: alkaid-front-dev # 标准化 appid
spec:
selector:
app: alkaid-front-dev
ports:
- name: port-0
protocol: TCP
port: 80 # 前端标准化 端口号
targetPort: 80
type: ClusterIP
```
## 后端JAVA Deployment
```
kind: Deployment
apiVersion: apps/v1
metadata:
name: alkaid-service-dev # 标准化APPID
namespace: compass-dev # 部署环境
spec:
replicas: 1
selector:
matchLabels:
app: alkaid-service-dev
template:
metadata:
labels:
app: alkaid-service-dev
spec:
containers:
- name: container-1688016072538
image: cce-xc-dev.hx168.com.cn/hx168-dev/alkaid:f73973b
env: # APM 组件默认变量
- name: DD_AGENT_HOST
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: DD_SERVICE
value: alkaid-service-dev
args: #应用启动命令
- '-c'
- >-
java
-javaagent:/opt/spring/ddagent/dd-java-agent-1.17.0-guance.jar # APM 探针
-Ddd.profiling.enabled=true # 热点代码功能
-Ddd.tags=container_host:$(POD_NAME),node_ip:$(DD_AGENT_HOST),cluster_name_k8s=arm-cluster1,namespace=compass-dev
-Ddd.env=hx168-dev # GC 空间指定
-Ddd.agent.port=9529
-server -Xms512m -Xmx1024m -jar -Dspring.cloud.nacos.discovery.username=CCE
-Dspring.cloud.nacos.discovery.password=hx@nacos##
-Dspring.cloud.nacos.discovery.server-addr=10.80.121.159:8848,10.80.121.160:8848,10.80.121.161:8848
-Dspring.cloud.nacos.discovery.namespace=a9cb25f3-88f6-4ae2-954d-3c97b9d89caf
-Dlogging.file=$LOG_ROOT/compass-alkaid.log /opt/spring/app.jar
command:
- sh
imagePullPolicy: Always
resources:
limits:
cpu: 1000m
memory: 1500Mi
requests:
cpu: 500m
memory: 512Mi
envFrom: []
volumeMounts:
- name: vol-1688094277851
readOnly: false
mountPath: /opt/logs/alkaid-service-dev/ # 应用日志采集路径
livenessProbe: # 健康检查地址
httpGet:
path: /api/v1/checkHealth
port: 8080
scheme: HTTP
timeoutSeconds: 1
initialDelaySeconds: 60
readinessProbe:
httpGet:
path: /api/v1/checkHealth
port: 8080
scheme: HTTP
timeoutSeconds: 1
initialDelaySeconds: 60
initContainers: []
imagePullSecrets:
- name: default-secret
volumes: # 应用日志宿主机隐射路径
- name: vol-1688094277851
hostPath:
path: /opt/logs/alkaid-service-dev/
```
## 日志规范 log4back.xml