sed command to replace the image in kubernetes yaml file [duplicate] sed command to replace the image in kubernetes yaml file [duplicate] kubernetes kubernetes

sed command to replace the image in kubernetes yaml file [duplicate]


The s command in sed can have different delimiters, if your pattern has / use something else in s command

ELASTICSEARCH_IMAGE='gcr.io/sample/elasticsearch:7.3.1'$ echo "      containers:        - image: {{ELASTICSEARCH}}                                                          name: elasticsearch" | sed "s|{{ELASTICSEARCH}}|$ELASTICSEARCH_IMAGE|"      containers:        - image: gcr.io/sample/elasticsearch:7.3.1                                                          name: elasticsearch