Chapter 5. Using the CLI tools


The two primary CLI tools used for managing resources in the cluster are:

  • The container-native virtualization virtctl client
  • The OpenShift Container Platform oc client

5.1. Prerequisites

5.2. Virtctl client commands

The virtctl client is a command-line utility for managing container-native virtualization resources. The following table contains the virtctl commands used throughout the container-native virtualization documentation.

Table 5.1. virtctl client commands
CommandDescription

virtctl start <vm>

Start a virtual machine.

virtctl stop <vm>

Stop a virtual machine.

virtctl restart <vm>

Restart a virtual machine.

virtctl expose <vm>

Create a service that forwards a designated port of a virtual machine or virtual machine instance and expose the service on the specified port of the node.

virtctl console <vmi>

Connect to a serial console of a virtual machine instance.

virtctl vnc <vmi>

Open a VNC connection to a virtual machine instance.

virtctl image-upload <…​>

Upload a virtual machine image to a PersistentVolumeClaim.

5.3. OpenShift Container Platform client commands

The OpenShift Container Platform oc client is a command-line utility for managing OpenShift Container Platform resources. The following table contains the oc commands used throughout the container-native virtualization documentation.

Table 5.2. oc commands
CommandDescription

oc login -u <user_name>

Log in to the OpenShift Container Platform cluster as <user_name>.

oc get <object_type>

Display a list of objects for the specified object type in the project.

oc describe <object_type> <resource_name>

Display details of the specific resource in the project.

oc create -f <object_config>

Create a resource in the project from a filename or from stdin.

oc edit <object_type> <resource_name>

Edit a resource in the project.

oc delete <object_type> <resource_name>

Delete a resource in the project.

For more comprehensive information on oc client commands, see the OpenShift Container Platform CLI tools documentation.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.