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.
73 lines
3.7 KiB
73 lines
3.7 KiB
apiVersion: apps/v1 #指定API版本标签
|
|
kind: Deployment #定义资源的类型/角色,deployment为控制器,service,endpoints
|
|
metadata: #定义资源的元数据信息
|
|
name: webproject-deployment #定义资源的名称,在同一个namespace空间中必须是唯一的
|
|
namespace: lk #默认default
|
|
labels: #定义资源标签
|
|
app: yaml-webproject-d
|
|
spec:
|
|
replicas: 1 #定义副本数量
|
|
selector: #定义选择器
|
|
matchLabels: #匹配上边的标签
|
|
app: yaml-webproject-d #名称
|
|
template: #定义模板
|
|
metadata:
|
|
labels:
|
|
app: yaml-webproject-d
|
|
spec:
|
|
containers: #定义容器信息
|
|
- name: yaml-webproject #容器名,与标签名要相同
|
|
image: repository.anxinyun.cn/anxinyun/project:latest #容器使用的镜像以及版本
|
|
imagePullPolicy: IfNotPresent #获取镜像的策略 Alawys表示下载镜像 IfNotPresent 表示优先使用本地镜像,否则下载镜像,Never表示仅使用本地镜像
|
|
env: #环境变量
|
|
- name: "ANXINCLOUD_API" #变量的名字
|
|
value: "http://webapi-service:8092" #变量的值
|
|
- name: "ANXINCLOUD_PROXY_IOTA"
|
|
value: "iota-proxy-service:8091"
|
|
- name: "ANXINCLOUD_HDFS_HTTP"
|
|
value: "http://10.8.30.155:50070"
|
|
#本地化 图片不存在 七牛#
|
|
- name: "ANXINCLOUD_QINIU_AK"
|
|
value: "5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu"
|
|
- name: "ANXINCLOUD_QINIU_SK"
|
|
value: "w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5"
|
|
- name: "ANXINCLOUD_QINIU_BUCKET_RESOURCE"
|
|
value: "anxinyun-test"
|
|
- name: "ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE"
|
|
value: "http://test.resources.anxinyun.cn"
|
|
- name: "ANXINCLOUD_FC_UPLOAD_PATH"
|
|
value: "upload"
|
|
- name: "ANXINCLOUD_FC_LOCAL_ROOT_PATH"
|
|
value: "static"
|
|
- name: "ANXINCLOUD_FC_LOCAL_CHILD_PATH"
|
|
value: "child"
|
|
ports:
|
|
- containerPort: 8080 #定义容器的端口
|
|
name: tcp-8080
|
|
command: ['node','server.js','-p','8080']
|
|
volumeMounts: #改容器内无法修改hosts 挂载出来修改
|
|
- name: vol-hosts #挂载设备的名字,与volumes[*].name 需要对应
|
|
mountPath: /etc/hosts # 容器的数据目录
|
|
volumes: # volumes和container处于同一层级,别搞错了
|
|
- name: vol-hosts
|
|
hostPath:
|
|
path: /etc/hosts # 宿主机目录 覆盖容器内目录 间接统一hosts
|
|
|
|
---
|
|
apiVersion: v1 #指定API版本标签
|
|
kind: Service #定义资源的类型/角色,Deployment为控制器,Service,endpoints
|
|
metadata: #定义资源的元数据信息
|
|
name: webproject-service #定义资源的名称,在同一个namespace空间中必须是唯一的
|
|
namespace: lk #默认default
|
|
labels: #定义资源标签
|
|
app: webproject-s
|
|
spec:
|
|
selector:
|
|
app: yaml-webproject-d #deployment标签
|
|
type: NodePort
|
|
ports:
|
|
- protocol: TCP
|
|
port: 8073 # 集群内访问
|
|
targetPort: 8080 #集群内 容器内端口
|
|
name: tcp-8080
|
|
nodePort: 30873 #集群外访问 范围30000-32767
|
|
|