Use rancher cli docking k8s

First, get a token rancher

1. Go to the rancher, click on the upper right corner of the pop-up box ApI & Keys

2. After entering the page, select Add key

 

 3. Note that this role must not be specified cluster-wide, otherwise errors occur when landing rancher on the server jenkins

  Click Create, get API access address, login key, password, token, etc., must be recorded here in their own local, after the Close nowhere to be found.

Second, the landing jenkins server, rancher landing configuration cli

1. Run: rancher login $ {API access} --token $ {address just obtained token}, to give the following interface

 

 2. Select yes, eject all projects, select projects where the command execution kubectl

Third, the implementation rancher cli command

In front of the original command plus rancher can kubectl

 

 

Guess you like

Origin www.cnblogs.com/yechen2019/p/11926746.html