Bootstrap FreeKB - OpenShift - Update a deployment YAML template file using the oc edit command
OpenShift - Update a deployment YAML template file using the oc edit command

Updated:   |  OpenShift articles

An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.

A  JSON or YAML file that contains key value pairs can be used to create an object, such as a config map, deployment, a project, a pod, a route, a secret, a service, et cetera. These files are known as templates. For example, let's say you have a YAML file named deployment.yml that contains the following markup. Notice "kind: Deployment", which means this template will be used to create a deployment.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-openshift
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-openshift
  template:
    metadata:
      labels:
        app: hello-openshift
    spec:
      containers:
      - name: hello-openshift
        image: openshift/hello-openshift:latest
        ports:
        - containerPort: 80

 

The oc apply or oc create command with the -f or --filename option can be used to create the deployment using the template JSON or YAML file.

The oc replace command can be used to replace a deployment using a new or updated template JSON or YAML file.

The oc edit command can be used to update a deployments template YAML file.

~]$ oc edit deployment hello-openshift
deployment.apps/hello-openshift edited

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d80492 in the box below so that we can be sure you are a human.