Skip to content

Krishnom/rancher-cli-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Rancher CLI Usage

Repo containing resource for rancher deployment and usage.

Prerequisites

While most of the stuffs are documented at rancher-cli (and it will work almost everytime) , This document contains any issue that you might while using the rancher's cli.

So what you need in all ?

Please use "no-scope" while creating API for user. see this issue

Example commands to operate rancher right from commandline on any machine.

Assuming your rancher-cli binary is at /usr/bin/rancher

Login

/usr/bin/rancher login https://<SERVER_URL> --token <BEARER_TOKEN>

Accept the Insecure PKI key prompt when asked. Select the context from the list of the context

Alternatively, To run command without any user interaction.

For below command you need PROJECT_ID. To retrieve it, you can checkout output of https://<SERVER_URL>/v3/projects?sort=description. Check the "data" field in the json and you will get all the projects details in it. The "id" field is what your project id will be. Check the "name" field to cross verify your project

/usr/bin/rancher login https://<SERVER_URL> --token <BEARER_TOKEN> --skip-verify --context <PROJECT_ID>

List of running containers/jobs/workload

/usr/bin/rancher ps

Running a job

/usr/bin/rancher kubectl apply -f <yaml file>

For yaml file sample, checkout nginx-deployment

Deleting the job

/usr/bin/rancher kubectl delete -f <yaml file>

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published