I recently ran into a scenario wherein I had to add port in a deploymentConfig(DC) file having multiple containers. “oc edit” is a quite handy command but it will open an editor thereby not useful when automating the updation. Let us take a look at the DC file and apply “oc patch” command on it to update certain fields.
apiVersion: v1
kind: DeploymentConfig
metadata:
name: test-deploy
labels:
app: test-deploy
spec:
replicas: 1
strategy:
type: Rolling
template:
metadata:
labels:
app: test-deploy
name: test-deploy
spec:
containers:
- name: my-first-image
image: image1
ports:
- containerPort: 8080
protocol: TCP - name: my-second-image image…
DevOps Engineer, Working at Mahindra Comviva. Docker-Kubernetes enthusiast.