
A JSON or YAML file that contains key value pairs 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. The oc explain command can be used to get the list of keys that can be used in the JSON or YAML template file.
oc explain pod
And then more details on each key can be displayed.
oc explain pod.metadata
For example, let's say you have a YAML file named group.yml that contains the following markup. In this example, a group named "my-group" will be created.
apiVersion: user.openshift.io/v1
kind: Group
metadata:
name: bogus
users:
- jone.doe
- jane.doe
The oc apply or oc create command with the -f or --filename option can be used to create the group using the template JSON or YAML file.
The oc replace command can be used to replace a group using a new or updated template JSON or YAML file.
The oc edit command can be used to update a group template YAML file.
~]$ oc apply --filename my_group.yml
group.user.openshift.io/my_group created
The oc get group command can then be used to ensure the group exists.
~]$ oc get group my_group
NAME USERS
my_group jone.doe, jane.doe
Did you find this article helpful?
If so, consider buying me a coffee over at