Bosh

From Leo's Notes
Revision as of 20:44, 26 August 2019 by Leo (talk | contribs) (Created page with " == Commands == === Obtaining Credentials === Before using any of the commands below, you will need to authenticate your bosh client against the bosh director. This can be d...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 26 August 2019, at 20:44.


Commands

Obtaining Credentials

Before using any of the commands below, you will need to authenticate your bosh client against the bosh director. This can be done using environment variables or by using the bosh login command.

With PKS, the Bosh credentials can be obtained from Ops Manager. Log in to Ops Manager, then navigate to Bosh Tile -> Credentials -> Bosh Commandline Credentials.

Set the following environment variables in a .bash_profile file:

export BOSH_CLIENT=ops_manager
export BOSH_CLIENT_SECRET=xxxxxxxxxxxxxxxx
export BOSH_CA_CERT=/var/tempest/workspaces/default/root_ca_certificate
export BOSH_ENVIRONMENT=172.31.0.3 bosh


Deployments

bosh deployments shows deployments tracked by the Bosh Director.

VMs

bosh vms shows VMs that are running for every deployment managed by Bosh Director. Specific deployments can be specified with the -d option.

Common options:

  • Show stats using --vitals
  • Cloud properties with --cloud-properties
# bosh vms -d service-instance_62e82b91-cabb-40f0-842c-e1c10a98f2f7 --vitals
Using environment '172.31.0.3' as client 'ops_manager'

Task 164927. Done

Deployment 'service-instance_62e82b91-cabb-40f0-842c-e1c10a98f2f7'

Instance                                     Process State  AZ           IPs          VM CID                                   VM Type     Active  VM Created At                 Uptime          Load              CPU    CPU   CPU   CPU    Memory        Swap         System      Ephemeral   Persistent
                                                                                                                                                                                                 (1m, 5m, 15m)     Total  User  Sys   Wait   Usage         Usage        Disk Usage  Disk Usage  Disk Usage
master/74eb8b50-da8f-4d51-9a26-c8ab63c2bc70  running        pks-compute  172.16.14.3  vm-ec465136-0887-4a17-9aa0-3b9be8a33469  xlarge      true    Fri Aug 23 22:04:07 UTC 2019  2d 22h 27m 35s  0.15, 0.10, 0.08  -      1.0%  0.7%  4.6%   9% (1.5 GB)   0% (0 B)     46% (33i%)  13% (3i%)   4% (0i%)
master/c8cd7497-78bb-49a8-a092-264cbad73100  running        pks-compute  172.16.14.2  vm-f82f0fe9-cd61-40cd-86bb-ac60c88143ca  xlarge      true    Fri Aug 23 22:04:07 UTC 2019  2d 22h 27m 34s  0.10, 0.14, 0.15  -      0.9%  0.6%  7.5%   10% (1.6 GB)  0% (0 B)     46% (33i%)  13% (3i%)   4% (0i%)
master/d50104c4-759f-40e7-b55f-15aa93083272  running        pks-compute  172.16.14.4  vm-1ffa5f44-2d08-4080-808c-4733e98bc954  xlarge      true    Fri Aug 23 22:04:06 UTC 2019  2d 22h 27m 34s  0.04, 0.08, 0.08  -      0.6%  0.2%  0.3%   9% (1.5 GB)   0% (0 B)     46% (33i%)  13% (3i%)   4% (0i%)
worker/6f3ec8e8-8976-449d-851b-83803a67d348  running        pks-compute  172.16.14.5  vm-4eccd396-a040-44ac-8fdb-61bbf87ef024  large.disk  true    Fri Aug 23 22:04:08 UTC 2019  2d 22h 27m 34s  2.04, 2.82, 2.10  -      5.7%  2.7%  44.7%  40% (3.3 GB)  0% (4.1 MB)  46% (33i%)  7% (1i%)    12% (6i%)

4 vms

Tasks

bosh tasks shows tasks and errands that are currently running by the Bosh Director. Show completed recent tasks with -r[=n] or --recent[=n] flags, with optional n value to specify n results.

bosh task n show specific task logs for task n. Common flags

  • --debug to get debug logs
  • --cpi to show cloud provider interface logs

Instances

bosh instances shows instances in deployments. Common flags:

  • --details to show details
  • --ps to show process for each instance, which shows the Monit status in each VM

SSH

bosh ssh -d deployment vm creates a SSH connection to the particular VM.

Cleanup

bosh clean-up removes all unused releases and stemcells.

# bosh clean-up
Using environment '172.31.0.3' as client 'ops_manager'

Continue? [yN]: y

Task 164925

Task 164925 | 20:29:18 | Deleting stemcells: bosh-vsphere-esxi-ubuntu-xenial-go_agent/250.29 (00:00:12)
Task 164925 | 20:29:30 | Deleting dns blobs: DNS blobs (00:00:00)

Task 164925 Started  Mon Aug 26 20:29:18 UTC 2019
Task 164925 Finished Mon Aug 26 20:29:30 UTC 2019
Task 164925 Duration 00:00:12
Task 164925 done

Succeeded

Locks

bosh locks lists current locks held by different tasks or deployments

Errands

bosh errands lists all errands defined by a deployment

bosh run-errands runs an errand by a job name, in a particular deployment

Logs

bosh logs shows logs from a particular deployment.