Bootstrap FreeKB - OpenShift - Getting Started with the oc command
OpenShift - Getting Started with the oc command

Updated:   |  OpenShift articles

The oc command is used to perform a variety of tasks, such as displaying the nodes in your cluster, creating a secret, viewing logs, and the list goes on. The oc command with the --help flag is used to display the basic usage of the oc command.

oc --help

 

This will return quite a bit of output. Near the top of the output is the following.

Basic Commands:
  types           An introduction to concepts and types
  login           Log in to a server
  new-project     Request a new project
  new-app         Create a new application
  status          Show an overview of the current project
  project         Switch to another project
  projects        Display existing projects
  explain         Documentation of resources
  cluster         Start and stop OpenShift cluster

 

What this is saying is that options such as login, project, status, and so on, can be used with the oc command, like this.

oc login

 

Let's say you want more information on the oc login command. Again, the --help flag can be used.

oc login --help

 

Which will display information about the login command.

Log in to your server and save login for subsequent use 

First-time users of the client should run this command to connect to a server, establish an authenticated session, and
save connection to the configuration file. The default configuration will be saved to your home directory under
".kube/config". 

The information required to login -- like username and password, a session token, or the server details -- can be
provided through flags. If not provided, the command will prompt for user input as needed.

Usage:
  oc login [URL] [flags]

Examples:
  # Log in interactively
  oc login
  
  # Log in to the given server with the given certificate authority file
  oc login localhost:8443 --certificate-authority=/path/to/cert.crt
  
  # Log in to the given server with the given credentials (will not prompt interactively)
  oc login localhost:8443 --username=myuser --password=mypass

Options:
  -p, --password='': Password, will prompt if not provided
  -u, --username='': Username, will prompt if not provided      --certificate-authority='': Path to a cert file for the
certificate authority
      --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will
make your HTTPS connections insecure
      --token='': Bearer token for authentication to the API server

Use "oc options" for a list of global command-line options (applies to all commands).

 




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 bb0900 in the box below so that we can be sure you are a human.