For instance can I have following yaml to produce a pod with multiple containers:
apiVersion: v1
kind: Pod
metadata:
name: lampapp
labels:
app: app
spec:
containers:
- name: lampdb
image: mysql_test
- name: app
image: php-app-db-url-env
env:
- name: DB_URL
value: 127.0.0.1:3306
- name: app2
image: php-app-db-url-env
env:
- name: DB_URL
value: 127.0.0.1:3306
Yes, you can add multiple container with same image.
The containers object must contain:
unique
within the pod. Cannot be updated. You have to make container name unique
You can do following:
- name: app
image: php-app-db-url-env ---
- name: app2 |> same image
image: php-app-db-url-env ---
But not this one:
- name: app
image: php-app-db-url-env
- name: app
image: <any image>
Also the containers spec should include a unique port number within the Pod
可以存在相同类型的容器,但是它们的端口将不同。
好吧,这就是Pod的确切含义:共享某些命名空间和卷的多个容器。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.