How to use Rancher CLI
Objective
Managed Rancher Service by OVHcloud provides a powerful platform for orchestrating Kubernetes clusters seamlessly. In this tutorial we will discover that in addition to the Rancher UI you can handle your Kubernetes clusters through the Rancher CLI.
Requirements
- A Public Cloud project in your OVHcloud account
- An OVHcloud Managed Rancher Service (see the creating a Managed Rancher Service guide for more information)
- An access to the Rancher UI to operate it (see the connecting to the Rancher UI guide for more information)
Instructions
Rancher CLI
The Rancher CLI (Command Line Interface) is a unified tool that you can use to interact with an OVHcloud Managed Rancher Service (MRS). With this tool, you can operate MRS using a command line rather than the UI.
Downoad and install Rancher CLI
To download the Rancher CLI, log in your Managed Rancher Service UI and click on the About link at the bottom of the navigation sidebar menu:

Under the CLI Downloads section, click to download the binaries for your OS (macOS, Linux or Windows), untar the package and copy the rancher binary in your PATH.
You can download the binaries directly in the Rancher CLI GitHub repository.
Generate an API Key to use the Rancher CLI
To use the Rancher CLI and login to our OVHcloud MRS, you need to create an API Key.
On the top right, click on your avatar and then on the Account & API Keys button menu.
![]()
The Account and API Keys page is displayed.

Click on the Create API Key button to create an API key.
Define a description that will identify your API Key (CLI for example), keep the scope value to No Scope by default and define the expiration date.

You can change the scope to allow the Rancher CLI to access only one of your Kubernetes clusters if you wish.
Then click on the Create button.
A new API Key has been created.
Copy and paste in a password manager the Access Key, the Secret Key and the Bearer Token.
Using the Rancher CLI
Login with the CLI to your MRS:
You should have the following result:
Now you are authenticated in your MRS, you can display the list of Kubernetes clusters:
As you can see, in our example, we have one MKS cluster and one existing cluster we imported before.
Select one of the Kubernetes clusters:
By choosing 3, you switched in the my-kube cluster.
List the pods in the my_kube cluster directly through the Rancher CLI:
Go further
-
If you want to know more about the Rancher CLI and all its commands, read the Rancher CLI documentation.
-
To have an overview of OVHcloud Managed Rancher Service, you can go to the OVHcloud Managed Rancher Service page.
-
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.
-
Our team remains available on our dedicated Discord Channel, do not hesitate to join and reach us : https://discord.gg/ovhcloud. Ask questions, provide feedback and interact directly with the team that builds our Container and Orchestration services.
-
Join our community of users.