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

DevOps Engineer, Working at Mahindra Comviva. Docker-Kubernetes enthusiast.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store