Open In App

OpenShit CLI

Last Updated : 11 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

OpenShift CLI is an amazing tool that works with the management of resources inside the OpenShift container platform. In this article, we will investigate the different parts of the OpenShift CLI, its elements, establishment systems, and give instances of orders to arrangement and deletion of resources.

The OpenShift CLI (Command Line Interface) is a tool for interacting with and managing OpenShift container platform resources from the command line. It gives engineers and heads a strong and productive method for performing different undertakings, for example, sending applications, scaling assets, overseeing clients, and observing the stage.

What Is The Openshift CLI?

The OpenShift CLI (Command Line Interface) is a tool for interacting with and managing OpenShift container platform resources from the command line. It gives developer and heads a strong and productive method for performing different undertakings, for example, sending applications, scaling assets, overseeing clients, and observing the stage.

Openshift Architecture Diagram

Openshift Architecture Overview

The OpenShift CLI’s architecture is based on how it interacts with the OpenShift platform, which has several important parts:

  • Client Component: The OpenShift CLI itself, is introduced on the client’s neighborhood machine or inside a containerized climate. It speaks with the OpenShift Programming interface server to execute orders and oversee resources.
  • Server For OpenShift API: This is the focal part of the OpenShift stage, liable for handling Programming interface demands from clients (including the CLI) and overseeing assets inside the bunch. It makes RESTful endpoints available for the CLI to use in a variety of ways.
  • Authority And Authentication: OpenShift gives vigorous validation and approval instruments to control admittance to the stage. Clients confirm themselves utilizing accreditations, for example, usernames and passwords or through other verification techniques like tokens or endorsements. Authorization ensures that users have the permissions they need to carry out particular actions on the platform.
  • OpenShift Cluster: The hidden foundation that has the OpenShift stage, commonly involving numerous hubs (servers) organized by Kubernetes. The group incorporates parts, for example, the etcd appropriated key-esteem store, Kubernetes Programming interface server, regulator director, scheduler, and kubelet running on every hub.
  • Network Infrastructure: OpenShift depends on an network infrastructure to work with correspondence between parts inside the group and with outer frameworks. This incorporates organizing modules like OpenShift SDN (Software Defined Networking) or other outsider answers for systems administration and load balancing.

Installation Setup Of Openshift CLI in Linux: A Step-By-Step Guide

Step 1: Firstly, we need to login to AWS Console with credentials or else create account.

  • Now go to EC2 instance dashboard and launch an Instance with specifications is Amazon Linux 2 Kernel 5.10(AMI) along with allow all traffic by selecting storage t3. small

EC-2 Instance

Step 2: After launching an instance connect it with Git bash terminal by using PEM File or else any other terminals which is available like powershell, putty, GIT GUI e.t.c..

EC2 Console Login

Step 3: Download the OpenShift CLI binary with the following command with link:

wget https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz

Step 4: Extract the tar.gz file with the following command:

tar -xzvf oc.tar.gz

tar

Step 5: Move the oc binary to a directory in your PATH:

sudo mv oc /usr/local/bin/

Step 6: Verify the installation with the following command:

oc version

OC Version

Step 7: Installation of AWS CLI

  • Make sure you have AWS CLI installed on your machine. You can download and install it from the official AWS CLI website.
  • Open your terminal or command prompt where you want to configure the AWS CLI.

Run AWS Configure: Execute the following command to start the configuration process

aws configure

AWS configuration

Step 8: Enter AWS Access Key ID

AWS Access Key ID [None]: YOUR_ACCESS_KEY_ID
  • Enter AWS Secret Access Key: Next, enter the AWS Secret Access Key corresponding to the Access Key ID you provided in the previous step.
AWS Secret Access Key [None]: YOUR_SECRET_ACCESS_KEY
  • Choose Default Region: Enter your preferred default region. This is the AWS region where your resources will be created if you don’t specify a region in your commands.
Default region name [None]: your-preferred-region
  • Choose Default Output Format: Choose the default output format. Common choices are json, text, or table.
Default output format [None]: json

Step 9: Verify Configuration

  • The AWS CLI will display a summary of the information you entered. Verify that the details are correct.
AWS Access Key ID: YOUR_ACCESS_KEY_ID
AWS Secret Access Key: YOUR_SECRET_ACCESS_KEY
Default region name: your-preferred-region
Default output format: json
  • Configuration Complete: Once you’ve verified the configuration, the AWS CLI will confirm that the configuration is complete.
  • AWS CLI is now configured.

Step10: Test Your Configuration by running a simple AWS CLI command to test your configuration, for example:

aws s3 ls

aws s3 ls

  • This command lists the S3 buckets in your account. If the configuration is correct, you should see a list of your S3 buckets if any bucket are created in your account.

Examples Of Openshift Commands

Example 1 : Verify Installation

  • Run the following command to verify that the OpenShift CLI is installed and accessible:
oc version

Example 2: Login To OpenShift Cluster

  • Use the oc login command to log in to your OpenShift cluster. You will need the URL of your OpenShift cluster and valid credentials.
oc login <cluster_url>

cluster login

Example 3: Verify Connection

  • Run the following command to verify that you are connected to the OpenShift cluster:
oc whoami
oc get nodes
oc get csr
  • It should display information about the currently logged-in user.

Listing Pods In Openshift

Example 4: Explore OpenShift Commands

  • You can now use the oc command to interact with your OpenShift cluster. For example, you can list pods, services, or deploy applications.
oc get pods
oc get services
oc get cluster operators

listing cluster operators in openshift

Features Of Openshift CLI

The following are the features of openshift CLI:

  • Resource Management: The OpenShift CLI engages clients to really manage various resources inside the OpenShift stage, including cases, administrations, arrangement, courses, etc. Clients can create, update, delete, and inspect resources with instinctive commands, giving them granular control over their applications and infrastructure.
  • Application Deployment: Enhancing the arrangement cycle, the OpenShift CLI licenses clients to effectively convey containerized applications onto the stage. By deciding sending game plans, pictures, and various boundaries, architects can reliably do new application variations and updates with insignificant effort.
  • Scaling and Autoscaling: Scaling applications to fulfill changing need is simple with the OpenShift CLI. Customers can ensure optimal asset utilization by scaling individual components or entire arrangements evenly or upward. Additionally, automated level pod autoscaling (HPA) can be sorted out to change resources considering liability estimations intensely.
  • Monitoring and Logging: The OpenShift CLI provides requests to checking application prosperity, resource use, and structure estimations. Clients can recuperate steady estimations, view logs, and examine issues directly from the request line, working with proactive noticing and exploring of purposes.
  • Security and Access Control: With fiery approval and endorsement capacities, the OpenShift CLI grants clients to supervise client access, occupations, and assents inside the stage. Heads can make and give out positions, portray security procedures, and approve consistency standards, ensuring secure induction to resources.
  • Integration: The OpenShift CLI perfectly facilitates with other DevOps instruments and work processes, enabling clients to coordinate OpenShift assignments into their ongoing pipelines. Furthermore, the CLI is viable with modules and expansions, making it conceivable to adjust and extend its usefulness to address explicit issues and use cases.
  • Infrastructure Management: Past application the chiefs, the OpenShift CLI offers orders for directing key structure parts like center nodes, storage, network, and namespaces. Clients can game plan, plan, and manage infrastructure resources for ensure the smooth operation of their applications.
  • Developer Productivity: Planned with designer efficiency , the OpenShift CLI streamlines ordinary tasks and work processes, engaging fast accentuation and course of action of purposes. Because commands are clear and concise, developers can focus on building and inventing without being distracted by administrative overhead.

Advanced Features of OpenShift CLI

The following are the advanced features of Openshift CLI:

  • Advanced Deployment Strategies: OpenShift CLI supports advanced deployment strategies such as A/B testing, blue-green deployments, and canary releases. These strategies allow you to release and test new versions of applications with minimal downtime and risk.
  • Custom Resource Definitions (CRDs): OpenShift CLI supports managing custom resources defined by Custom Resource Definitions (CRDs). CRDs allow you to extend the Kubernetes API and manage custom resources specific to your applications.
  • Advanced Networking: OpenShift CLI provides commands for managing advanced networking features such as configuring routes, ingress controllers, and handling network policies to control communication between pods.
  • Storage Management: OpenShift CLI includes commands for managing storage resources, such as creating and managing persistent volumes (PVs) and persistent volume claims (PVCs). This is crucial for applications requiring persistent storage.
  • Role-Based Access Control (RBAC): OpenShift CLI allows users to interact with RBAC features, defining roles and role bindings to control access to resources within the cluster. This enhances security by ensuring that users have the necessary permissions.
  • Integration with Source Control (Git): OpenShift CLI facilitates integration with source control systems, allowing you to trigger deployments based on changes in Git repositories. This enhances automation and supports continuous integration workflows.
  • Advanced Logging and Monitoring: OpenShift CLI commands can be used to interact with advanced logging and monitoring features. This includes retrieving logs, setting up log forwarding, and accessing metrics and monitoring data for applications.

Conclusion

In conclusion, the OpenShift CLI is a useful asset that goes past essential asset the executives. Its high level elements engage clients to carry out refined arrangement techniques, modify asset definitions, oversee complex systems administration setups, handle capacity, implement role based access control, integrate with source control, and influence progressed logging and monitoring abilities.

By mastering the OpenShift CLI’s high level elements, clients can streamline their containerized application work processes, further develop cooperation among groups, and ensure the security, scalability, and reliability of utilizations sent on the OpenShift platform. To take advantage of the most recent OpenShift CLI capabilities, keep referring to the official documentation and staying up to date on new releases as you explore these advanced features.

Openshift CLI – FAQs

What Is OpenShift CLI Used For?

OpenShift CLI (oc) is utilized to associate with and oversee assets inside the OpenShift compartment stage. It permits clients to send applications, manage projects, scale resources, and perform different procedure on OpenShift clusters.

How Would I Install OpenShift CLI?

Installation steps for OpenShift CLI change in light of the operating system. For the most part, you can download the CLI parallel from the OpenShift discharge page and move it to a registry in your framework’s Way. Refer to the authority documentation for definite directions.

Could I At Any Point Utilize OpenShift CLI With Kubernetes Cluster?

Yes, OpenShift CLI is viable with Kubernetes bunches. Notwithstanding, it is explicitly intended for overseeing assets inside the OpenShift compartment stage, which expands Kubernetes with extra elements.

Could I Utilize oc With Kubernetes Cluster?

Yes, oc can associate with Kubernetes bunches. However, it’s particularly intended for OpenShift, and certain highlights and orders may be OpenShift-explicit.

How Might I Get Data About Pods In A Task?

You can utilize the oc get cases order to list all units in the ongoing venture. For more nitty gritty data, you can utilize oc depict unit <pod_name>.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads