OpenShift - Installing CLI (OC) in Windows | Openshift Command Line Interface
The OpenShift Command Line Interface (CLI) is a powerful tool used to interact with and manage OpenShift clusters. It allows administrators, developers, and operators to perform various tasks from the command line. Here are some commonly used OpenShift CLI commands:
oc login: Logs in to an OpenShift cluster. You need to provide the cluster URL, username, and password or authentication token.
oc new-project: Creates a new project or namespace within the cluster. Projects are used to isolate resources and provide a logical boundary for applications and services.
oc project: Switches to a different project. Once you've created multiple projects, you can use this command to switch between them.
oc new-app: Creates a new application from source code, a Docker image, or a template. This command simplifies the process of deploying applications on OpenShift.
oc get: Retrieves information about various resources in the cluster. You can use this command to list pods, services, deployments, routes, and more.
oc describe: Provides detailed information about a specific resource. You can use it to get more information about pods, services, deployments, and other OpenShift objects.
oc logs: Fetches the logs of a specific pod. You can use this command to view the output of containers running in pods and troubleshoot issues.
oc scale: Scales up or down the number of replicas for a deployment or a replication controller. This command allows you to adjust the desired number of instances for your application.
oc delete: Deletes a resource from the cluster. You can delete pods, services, deployments, routes, and other OpenShift objects using this command.
oc rollout: Manages rollouts and rollbacks of deployments. You can use this command to deploy new versions of an application or revert to a previous version.
These are just a few examples of the commands available in the OpenShift CLI. You can explore more commands and their options by using the oc help
command or referring to the OpenShift documentation for the specific version you are using.
INSTALLATION OF "OC" COMMAND LINE AT LOCAL WINDOWS.
- Open the following link and download the product software, as i install CRC on my local Windows 11 machine.
https://access.redhat.com/downloads/content/290/ver=4.10/rhel---8/4.10.12/x86_64/product-software
- Unzip the openshift v4.10.12 Windows clients on the local machine.
Open the CLI and mention the oc path environment variable, so that we can use oc from anywhere.
set PATH=%PATH%;E:\DEVOPS_TRAINING\OPEN SHIFT\open shift command line interface
oc version
oc status
oc login
- Get the authentication to the cluster using the following link.
https://oauth-openshift.apps-crc.testing/oauth/token/display
- After login, we can use the oc utility to access the openshift cluster.