OpenShift Command Line Tools: Difference between revisions
No edit summary |
|||
Line 11: | Line 11: | ||
=Configuration= | =Configuration= | ||
The tool configuration is maintained in user's [[.kube | The tool configuration is maintained in user's [[.kube config|~/<''user''>/.kube/config]]. | ||
=State= | =State= | ||
Both [[oc]] and [[oadm]] maintain state on the client host, under ~/<''user''>/.kube/<''cluster-identifier''> directories, and configuration in [[.kube | Both [[oc]] and [[oadm]] maintain state on the client host, under ~/<''user''>/.kube/<''cluster-identifier''> directories, and configuration in [[.kube config|~/<''user''>/.kube/config]]. Example: | ||
~ovidiu/.kube/master.openshift.novaordis.io_443 | ~ovidiu/.kube/master.openshift.novaordis.io_443 | ||
Line 21: | Line 21: | ||
=Context= | =Context= | ||
The context of an invocation consists in a project (namespace) name, an OpenShift cluster name, and the name of the OpenShift user. A list of known contexts, and the current context are maintained in user's [[.kube/config]]: | The context of an invocation consists in a project (namespace) name, an OpenShift cluster name, and the name of the OpenShift user. A list of known contexts, and the current context are maintained in user's [[.kube config|.kube/config]]: | ||
[...] | [...] | ||
Line 40: | Line 40: | ||
=Namespace Selection= | =Namespace Selection= | ||
By default, oc selects objects from the [[OpenShift_Concepts#Current_Project|current project]], which is the project oc commands apply to, without to explicitly having to use the -n <project-name> qualifier. The current project is part of the CLI tool's [[#Context|current context]], maintained in user's [[.kube/config]]. To switch to a different current project, use: | By default, oc selects objects from the [[OpenShift_Concepts#Current_Project|current project]], which is the project oc commands apply to, without to explicitly having to use the -n <project-name> qualifier. The current project is part of the CLI tool's [[#Context|current context]], maintained in user's [[.kube config|.kube/config]]. To switch to a different current project, use: | ||
[[oc project|oc project ''<new-current-project>'']] | [[oc project|oc project ''<new-current-project>'']] | ||
for both [[oc]] and [[oadm]]. | for both [[oc]] and [[oadm]]. |
Revision as of 21:41, 7 September 2020
Internal
Overview
User may interact with OpenShift by sending REST API invocations into an OpenShift master. Project-related queries and administrative commands may be sent with oc. Special administrative commands related to core OpenShift services, may be sent with oadm.
Configuration
The tool configuration is maintained in user's ~/<user>/.kube/config.
State
Both oc and oadm maintain state on the client host, under ~/<user>/.kube/<cluster-identifier> directories, and configuration in ~/<user>/.kube/config. Example:
~ovidiu/.kube/master.openshift.novaordis.io_443
Context
The context of an invocation consists in a project (namespace) name, an OpenShift cluster name, and the name of the OpenShift user. A list of known contexts, and the current context are maintained in user's .kube/config:
[...] contexts: - context: cluster: master-openshift-novaordis-io:443 namespace: default user: system:admin/master-openshift-novaordis-io:443 name: default/master-openshift-novaordis-io:443/system:admin - context: cluster: master-openshift-novaordis-io:443 namespace: playground user: system:admin/master-openshift-novaordis-io:443 name: playground/master-openshift-novaordis-io:443/system:admin current-context: default/master-openshift-novaordis-io:443/system:admin [...]
Namespace Selection
By default, oc selects objects from the current project, which is the project oc commands apply to, without to explicitly having to use the -n <project-name> qualifier. The current project is part of the CLI tool's current context, maintained in user's .kube/config. To switch to a different current project, use:
oc project <new-current-project>