I am using v1beta2 of kubernetes and I have Deployment
kind of configuration. In this configuration, I have a base conf of my app and I want to add conditionally a second docker image (container) in the same pod.
My config file :
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: ${MY_APP_NAME}
spec:
containers:
- name: my_first_container
image: image_url
[...]
- name: my_second_container <------ I want to put conditional declaration of this container
[...]
I don't want to add the second container in a spearate pod.
The condition is based on a variable like ${K8S_CONTAINER2_CONDITION} valued by sed command in linux. This command replace variables like ${MY_APP_NAME}.
How can I put conditional declaration of this container ? For some applications, I need to deploy both containers and for others, only the first one. But I have only one k8s configuration file (yaml).
you should look at helm charts for customizing the deployment file at deploy time