乙個容器多個程序,乙個pod多個容器

2022-05-08 11:21:11 字數 2358 閱讀 6041

乙個容器多個程序:在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 中定義兩個容器

# each master and worker node in a kubernetes cluster.

kind: daemonset

apiversion: extensions/v1beta1

metadata:

name: contiv-netplugin-ovs

namespace: kube-system

labels:

spec:

updatestrategy:

type: ondelete

selector:

matchlabels:

template:

metadata:

labels:

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:

可以在每個容器中啟動乙個程序,例如可以使用command啟動程序:

command:

- /bin/sh

- -c

- /kubemark --morph=kubelet --name=$(node_name) --kubeconfig=/kubeconfig/kubelet-$(node_name).kubeconfig $(content_type) --alsologtostderr --v=4

這樣乙個pod中啟動了兩個容器,每個容器啟動了乙個程序。

乙個容器中執行多個前台程序

背景 在docker容器中,如果乙個容器只執行乙個程序服務是蠻簡單的,通過dockerfile中cmd就可以實現,如果有引數也只需使用enterpoint,cmd作為引數傳入即可。然而所有事物都不是一層不變的,由於業務的需要本將nodejs執行的任務改為用python執行,這樣意味著乙個python...

乙個程序控制多個socket

module test tcp compile export all include lib kernel include inet.hrl define tcp options,binary,test pid spawn link module,loop,gen tcp listen 6099,t...

乙個ViewController對應多個Xib

比例係數開發的大概步驟 1.選著乙個尺寸作為開發設計的基準 2.制定其他螢幕的適配規則 3.特殊的適配給出具體的效果圖 例如攜程的比例係數 5 autosizescalex 1 autosizescaley 1 6 autosizescalex 1.171875 autosizescaley 1.1...