You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
3.8 KiB
78 lines
3.8 KiB
3 years ago
|
apiVersion: apps/v1 #指定API版本标签
|
||
|
kind: Deployment #定义资源的类型/角色,deployment为控制器,service,endpoints
|
||
|
metadata: #定义资源的元数据信息
|
||
|
name: webapi-deployment #定义资源的名称,在同一个namespace空间中必须是唯一的
|
||
|
namespace: lk #默认default
|
||
|
labels: #定义资源标签
|
||
|
app: yaml-webapi-d
|
||
|
spec:
|
||
|
replicas: 1 #定义副本数量
|
||
|
selector: #定义选择器
|
||
|
matchLabels: #匹配上边的标签
|
||
|
app: yaml-webapi-d #名称
|
||
|
template: #定义模板
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: yaml-webapi-d
|
||
|
spec:
|
||
|
containers: #定义容器信息
|
||
|
- name: yaml-webapi #容器名,与标签名要相同
|
||
|
image: repository.anxinyun.cn/anxinyun/api:137.21-08-17
|
||
|
imagePullPolicy: IfNotPresent #获取镜像的策略 Alawys表示下载镜像 IfNotPresent 表示优先使用本地镜像,否则下载镜像,Never表示仅使用本地镜像
|
||
|
env: #环境变量
|
||
|
- name: "ANXINCLOUD_PROXY_IOTA" #变量的名字
|
||
|
value: "iota-proxy-service:8091" #变量的值
|
||
|
- name: "ANXINCLOUD_HDFS_HTTP"
|
||
|
value: "http://10.8.30.155:50070"
|
||
|
- name: "ANXINCLOUD_KAFKA_BROKERS"
|
||
|
value: "kafka-service:9092"
|
||
|
- name: "ANXINCLOUD_ES_NODES_REST"
|
||
|
value: "es-service:9200"
|
||
|
- name: "ANXINCLOUD_DB"
|
||
|
value: "postgres://postgres:example@pg-service:5432/axy"
|
||
|
- name: "ANXINCLOUD_FC_UPLOAD_PATH"
|
||
|
value: "upload"
|
||
|
- name: "ANXINCLOUD_FC_LOCAL_ROOT_PATH"
|
||
|
value: "static"
|
||
|
- name: "ANXINCLOUD_FC_LOCAL_CHILD_PATH"
|
||
|
value: "child"
|
||
|
- name: "ANXINCLOUD_PYRPC_URL"
|
||
|
value: "rpc-service:25000"
|
||
|
- name: "PLATFORM_NAME"
|
||
|
value: "native"
|
||
|
ports:
|
||
|
- containerPort: 8080 #定义容器的端口
|
||
|
name: tcp-8080
|
||
|
command: ['node','server.js','--redis','redis-service:6379']
|
||
|
volumeMounts: #改容器内无法修改hosts 挂载出来修改
|
||
|
- name: vol-hosts #挂载设备的名字,与volumes[*].name 需要对应
|
||
|
mountPath: /etc/hosts # 容器的数据目录
|
||
|
- name: vol-static # 报表模板存储
|
||
|
mountPath: /var/app/static # 容器的数据目录
|
||
|
volumes: # volumes和container处于同一层级,别搞错了
|
||
|
- name: vol-hosts
|
||
|
hostPath:
|
||
|
path: /etc/hosts # 宿主机目录 覆盖容器内目录
|
||
|
- name: vol-static
|
||
|
hostPath:
|
||
|
path: /home/anxinlocal/static # 宿主机目录 覆盖容器内目录
|
||
|
|
||
|
---
|
||
|
apiVersion: v1 #指定API版本标签
|
||
|
kind: Service #定义资源的类型/角色,Deployment为控制器,Service,endpoints
|
||
|
metadata: #定义资源的元数据信息
|
||
|
name: webapi-service #定义资源的名称,在同一个namespace空间中必须是唯一的
|
||
|
namespace: lk #默认default
|
||
|
labels: #定义资源标签
|
||
|
app: webapi-s
|
||
|
spec:
|
||
|
selector:
|
||
|
app: yaml-webapi-d #deployment标签
|
||
|
type: NodePort
|
||
|
ports:
|
||
|
- protocol: TCP
|
||
|
port: 8092 # 集群内访问
|
||
|
targetPort: 8080 #集群内 容器内端口
|
||
|
name: tcp-8080
|
||
|
nodePort: 30892 #集群外访问 范围30000-32767
|