Just Another IT Blog

It's time to share some of my experiences, crazy ideas, tips and tricks !!!

Post Page Advertisement [Top]

While VMware Pivotal Container Service UI is great, there are a few things you still need to perform on the command line (or API requests), like troubleshooting and stuff.

Of course, you could just SSH into Ops Manager and run every command from there, but giving access to this crucial resource to others is far from ideal.
That’s why I decided to create some basic tutorials on how to access and perform PKS tasks remotely throughout the CLI.

The tutorials will cover:

Bosh CLI is intended to manage Bosh resources, tasks and objects; In other for PKS to be able to instantiate VMs (K8s Master and Nodes) on vCenter, it needs a broker which has specific vSphere CPI, that’s the Ops Director you first deploy on your PKS environment.



After you deploy it you can connect to the Bosh Director service running within and see the VMs and tasks it’s managing.

*** Installing Bosh CLI ***

- Download bosh cli;   
  Run: wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-2.0.48-linux-amd64
 

- Make it executable;
  Run: chmod +x bosh-cli-2.0.48-linux-amd64

- Move the CLI to the bin directory;
  Run: cp bosh-cli-2.0.28-linux-amd64 /usr/local/bin/bosh


- You can test if it's installed properly;
  Run: bosh -v

*** Connecting to Bosh Director ***
Once you get the bosh CLI installed you can point it to your Bosh Director and start issuing commands.

If you are using a self-signed certificate, don’t forget to first download the root CA certificate
- Go to PKS Settings;

On the Advanced option, download the Root CA Certificate;



- Create an environment alias for future reference;
  Run: bosh alias-env "alias" -e "Ops-Director" --ca-cert "CA_CERT_Path"

- Login with the desired credentials (for this purpose I’m using director);
  Run: bosh -e “alias” log-in

You can get the credentials from the Ops Director’s Credentials tab



You are ready to go !! It's possible to create as many environments as you need and you just need to specify which environment the command will run against, like:
bosh -e "alias" tasks

But, If you have a single environment it’s easier to set up a system environment and then you can omit the parameter.
Export BOSH_ENVIRONMENT=”alias”

*** Bosh CLI examples ***

Here are a few commands to get you started

Checking all tasks performed on the system;
Run: bosh tasks -ar

If you need details about a specific task;
Run: bosh tasks "ID" 

To list all VMs provisioned by the system;
Run:  bosh vms

SSH into a specific VM without providing any credentials;
Run: bosh ssh -e “alias” -d “deployment_ID” “vm_Instance”

You can get the deployment ID and VM instance from the bosh vms command.

that’s it, stay tuned for the next basic PKS tutorials.


Bottom Ad [Post Page]