OpenShift Command Line Tools: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


* [[OpenShift Concepts|OpenShift_Concepts#Command_Line_Tools]]
* [[OpenShift_Concepts#Command_Line_Tools|OpenShift Concepts]]
* [[oc]]
* [[oadm]]


=Overview=
=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]]
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]].


=State=
=Configuration=


<font color=red>describe the .kube/.../subdirectories.</font>
The tool configuration is maintained in user's  [[.kube config|~/<''user''>/.kube/config]].


=CLI Tool Context=
=State=


A command line tool ([[oc]] or [[oadm]]) maintains state on the client host, and an essential part of the state is the ''context''. A context consists in a project (namespace) name, an OpenShift cluster address, and the name of the OpenShift user under
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:


Context examples:
~ovidiu/.kube/master.openshift.novaordis.io_443


default/lb-local:443/system:admin
=Context=
{{Internal|.kube_config#Contexts|.kube/config Context}}


or
=Namespace Selection=


  playground/master-openshift-novaordis-io:443/ovidiu
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>'']]
for both [[oc]] and [[oadm]].

Latest revision as of 01:08, 20 November 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

.kube/config Context

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>

for both oc and oadm.