一个容器多个进程:在Docker的镜像编译脚本Dockerfile中带起多个进程,如下可以在contivNet.sh中启动多个进程
FROM 192.168.1.2:5001/world/centos7/ovs-2.6.4:1
COPY ./bin /contiv/bin/
COPY ./scripts /contiv/scripts/
ENTRYPOINT ["/contiv/scripts/contivNet.sh"]
一个pod多个容器,可以在yaml文件中如下设置,在containers 中定义两个容器
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: contiv-netplugin-ovs
namespace: kube-system
labels:
k8s-app: contiv-netplugin
spec:
updateStrategy:
type: OnDelete
selector:
matchLabels:
k8s-app: contiv-netplugin
template:
metadata:
labels:
k8s-app: contiv-netplugin
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9004'
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
hostNetwork: true
hostPID: true
nodeSelector:
node-role.kubernetes.io/node: ""
node-network-driver: "ovs"
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
serviceAccountName: contiv-netplugin
containers:
- name: netplugin-exporter
image: 192.168.1.2:5001/contiv/exporter:0.1
env:
- name: CONTIV_ETCD
valueFrom:
configMapKeyRef:
name: contiv-config
key: contiv_etcd
- name: CONTIV_ROLE
value: 'ovs-netplugin'
volumeMounts:
- mountPath: /k8s_log/contiv
name: var-log-contiv-exporter
readOnly: false
- name: contiv-netplugin
image: 192.168.1.2:5001/contiv/netplugin:1.2.0_6.3
env:
- name: CONTIV_ROLE
value: netplugin
- name: CONTIV_NETPLUGIN_VLAN_UPLINKS
value: enp130s0f0
- name: CONTIV_NETPLUGIN_DRIVER
value: ovs
- name: CONTIV_NETPLUGIN_LOG_LEVEL
value: INFO
- name: CONTIV_NETPLUGIN_MODE
valueFrom:
configMapKeyRef:
name: contiv-config
key: contiv_mode
- name: CONTIV_NETPLUGIN_VTEP_IP
valueFrom:
手机扫一扫
移动阅读更方便
你可能感兴趣的文章