I have one kubernetes deployment file for e.g:
I want that image_tag is passed at the command line when running the kubectl create -f deployment.yaml command. and suppose i did the export IMAGE_TAG=1.4.3 and want to use that ENV variable value is inserted at the position of image tag.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:{IMAGE_TAG}
ports:
- containerPort: 80
I do this:
sed -i "s/{IMAGE_TAG}/${IMAGE_TAG}/" deployment.yml
kubectl apply -f deployment.yml
as it is not supported by kubectl