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.
50 lines
2.8 KiB
50 lines
2.8 KiB
3 years ago
|
apiVersion: apps/v1 #指定API版本标签
|
||
|
kind: Deployment #定义资源的类型/角色,deployment为控制器,service,endpoints
|
||
|
metadata: #定义资源的元数据信息
|
||
|
name: config-center-deployment #定义资源的名称,在同一个namespace空间中必须是唯一的
|
||
|
namespace: lk #默认default
|
||
|
labels: #定义资源标签
|
||
|
app: yaml-config-center-d
|
||
|
spec:
|
||
|
replicas: 1 #定义副本数量
|
||
|
selector: #定义选择器
|
||
|
matchLabels: #匹配上边的标签
|
||
|
app: yaml-config-center-d #名称
|
||
|
template: #定义模板
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: yaml-config-center-d
|
||
|
spec:
|
||
|
containers: #定义容器信息 把数据库里传感器配置,写入redis
|
||
|
- name: yaml-config-center #容器名,与标签名要相同
|
||
|
image: repository.anxinyun.cn/local/config_center:latest #容器使用的镜像以及版本
|
||
|
imagePullPolicy: IfNotPresent #获取镜像的策略 Alawys表示下载镜像 IfNotPresent 表示优先使用本地镜像,否则下载镜像,Never表示仅使用本地镜像
|
||
|
env: #环境变量
|
||
|
- name: "CLUSTER" #变量的名字
|
||
|
value: "ANXINCLOUD" #变量的值
|
||
|
- name: "ANXINCLOUD_API"
|
||
|
value: "webapi-service:8092" ##注意 这里要先启动 anxin webapi
|
||
|
command: ['java','-jar','/app/config_center.jar','db.url=jdbc:postgresql://pg-service:5432/axy','db.user=postgres','db.pwd=example','iota.api.proxy=http://iota-proxy-service:8091/_iota_api','redis.host=redis-service','redis.port=6379' ,'kafka.brokers=kafka-service:9092']
|
||
|
volumeMounts: #改容器内无法修改hosts 挂载出来修改
|
||
|
- name: vol-config-centerc #挂载设备的名字,与volumes[*].name 需要对应
|
||
|
mountPath: /etc/hosts # 容器的数据目录
|
||
|
volumes: # volumes和container处于同一层级,别搞错了
|
||
|
- name: vol-config-centerc
|
||
|
hostPath:
|
||
|
path: /etc/hosts # 宿主机目录 覆盖容器内目录 间接统一hosts
|
||
|
|
||
|
---
|
||
|
#ET不对外提供服务 不启用service
|
||
|
# apiVersion: v1 #指定API版本标签
|
||
|
# kind: Service #定义资源的类型/角色,Deployment为控制器,Service,endpoints
|
||
|
# metadata: #定义资源的元数据信息
|
||
|
# name: config-center-service #定义资源的名称,在同一个namespace空间中必须是唯一的
|
||
|
# namespace: lk #默认default
|
||
|
# labels: #定义资源标签
|
||
|
# app: config-center-s
|
||
|
# spec:
|
||
|
# selector:
|
||
|
# app: yaml-config-center-d #deployment标签
|
||
|
# type: ClusterIP
|
||
|
|