0
点赞
收藏
分享

微信扫一扫

阿里云容器服务创建容器时选择特定的节点

Hyggelook 2022-09-01 阅读 169


前言

1、观察节点index

index哪里看,请登录ECS服务器,观察,比如下面就是idnex 2

root@c68d4b5dd583c4f4ea30da298934b37f8-node2:~# 

2、配置环境变量

  environment:
- constraint:aliyun.node_index==2

表达式

说明

constraint:aliyun.node_index==1

指定部署到 node1。

constraint:aliyun.node_index!=1

不部署到 node1。

constraint:aliyun.node_index==(1|2|3)

指定部署到 node1 或者 node2 或者 node3。

constraint:aliyun.node_index!=(1|2|3)

部署到除 node1、node2、node3 的其他机器上。

affinity:image==~redis

尽量部署到有 Redis 镜像的机器上。支持填写镜像全称,如 ​​registry.cn-hangzhou.aliyuncs.com/xxx/xxx​​。

affinity:service!=~redis

尽量不部署到有 Redis 服务的机器上。参见​​服务部署约束(affinity:service)​​。

server-xiaodang-8084:
restart: always
ports:
- '8084:8084/tcp'
environment:
- LANG=C.UTF-8
- JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
- spring.profiles.active=xiaodang
- server.port=8084
- constraint:aliyun.node_index==2
memswap_limit: 0
labels:
aliyun.scale: '1'
aliyun.routing.port_8084: 'http://xiaodangserver.duoquwawa.cn;http://xiaodangserver.duoquwawa.com;xiaodang'
shm_size: 0
image: 'registry-vpc.cn-qingdao.aliyuncs.com/duodianyouhui/dev-server:08291236'
memswap_reservation: 0
kernel_memory: 0
mem_limit: 0

阿里云容器服务创建容器时选择特定的节点_spring


举报

相关推荐

0 条评论