Skip to content

dennyzhang/cheatsheet-bosh-A4

Repository files navigation

1 Bosh CheatSheet

linkedin
github
slack


PRs Welcome

File me Issues or star this repo.

https://raw.githubusercontent.com/dennyzhang/cheatsheet-bosh-A4/master/bosh.jpg

1.1 Bosh Frequent-Used

NameCommand
List tasksbosh tasks -r=10, bosh -d $deployment tasks -ar
Tail latest bosh taskbosh task -a, bosh task -a --debug
List deployments and vmsbosh deployments, bosh -d $deployment vms
Bosh get current task outputbosh -d $deployment task $id --result
Bosh get task all detail logbosh -d $deployment task -a --debug, bosh -d $deployment task $id --debug
Delete a deploymentbosh delete-deployment -d $deployment, bosh delete-deployment -d $deployment --force
Upload releasebosh -n upload-release, bosh -n upload-release /tmp/my-release-0.22.0.tgz
Create bosh release tar from source codebosh-create-release.md
Get deployment manifest yamlbosh -d $deployment manifest > my.yaml
Run bosh deployment from yamlbosh -d $deployment deploy my.yaml
Run errand, and avoid deleting the vmsbosh -n -d $deployment run-errand $errand_name --keep-alive
Delete all or a given bosh deploymentcleanup-bosh-deployment.sh
Delete all or a given bosh releasecleanup-bosh-releases.sh
Common Bosh Releaseskubo-release, cfcr-etcd-release, docker-boshrelease, pxc-release, YouTube: BOSH Release
ReferenceLink: terminology, GitHub: cloudfoundry/bosh, CheatSheet: Cloudfoundry Tile & OpsManager
ReferencePKS CheatSheet, Bosh CheatSheet, Tile CheatSheet, UAA CheatSheet

1.2 Bosh Release

NameCommand
List releasebosh -n releases
Release folder/var/tempest/releases
Create a local releasebosh create-release --tarball=myrelease-0.4.0.tgz
Export a releasebosh -d $deployment export-release <my-release>/<release-version> ubuntu-xenial/170.9
Inspect a releasebosh inspect-release <my-release>/<release-version>
Delete releasebosh -n delete-release <my-release>/<release-version> --force
Upload releasebosh -n upload-release, bosh -n upload-release /tmp/my-release-0.22.0.tgz
Reset releasebosh reset-release
ReferenceLink: Release creation

1.3 Bosh Basic

NameCommand
boshapt install bosh-cli, /var/vcap/bosh/log, /var/vcap/sys/log
List all bosh deploymentsbosh -n deployments, bosh -n deployments --json
Download log filesbosh -d $deployment_id logs
Show deployment manifestbosh manifest -d $deployment
Show current cloud configbosh cloud-config, bosh cc, bosh configs
Show current CPI configbosh cpi-config
List environmentbosh env, bosh env --json, bosh envs
List all instancesbosh instances, bosh -d $deployment_id instances --ps
Get vms per deploymentbosh -e $env -d $deployment vms, bosh instances
Cloud consistency checkbosh cloud-check -d $deployment
List disksbosh disks -o

1.4 Bosh Interpolate

NameCommand
Bosh Interpolates variablesbosh int /tmp/build/4dcXX/pks-lock/metadata --path=/ops_manager/username
Bosh use a property within a template<%= p(‘some-property’) %>
Bosh use a property with default value<%= p(‘cluster-name’, <%= spec.deployment %>) %>
Bosh use a property conditionallybosh-if-property.md
Parse json outputbosh int --path=/uuid -, similar to jq command

1.5 Bosh Manifest

NameCommand
Show bosh manifestbosh manifest -d $deployment
Run bosh deployment from manifestbosh -d $deployment deploy my.yaml

1.6 Bosh VM

NameCommand
List vmsbosh -d $deployment vms
List vms with verbose infobosh -d $deployment vms --vitals
Delete a vmbosh -d $deployment delete-vm <vm-cid>>
SSH to vmbosh -d $deployment ssh $vm_name/$GUID
Run SSH commandsbosh -d $deployment ssh $vm_name>/$GUID -c "sudo cat /etc/hosts"
bosh scpbosh -d $deployment scp /tmp/myfile $vm_name/$GUID:/tmp/

https://raw.githubusercontent.com/dennyzhang/cheatsheet-bosh-A4/master/bosh-workflow-intro.jpg

1.7 Bosh Errand

NameCommand
List errandsbosh errands -d $deployment
Run errand in a new vmbosh -n -d $deployment run-errand <errand_name> Link: run-errand
Run errand in a new vm with env alivebosh -n -d $deployment run-errand <errand_name> --keep-alive
Run errand in an existing vmbosh -n -d $deployment run-errand <errand_name> --instance=worker/instance-id=XXX

1.8 Bosh Blob

NameCommand
ReferenceLink: Working with Blobs
Configure credentialPrepare config/private.yml
Add local file to blobbosh add-blob /tmp/<telegraf:1.7-alpine.tgz> container-images/telegraf:1.7-alpine.tgz
Upload blobsbosh upload-blobs
List blobbosh blobs
Remove blobbosh remove-blob container-images/cadvisor-v0.31.0.tgz

1.9 Bosh Task

NameCommand
List recent tasksbosh -d $deployment tasks --recent
List all tasksbosh -d $deployment tasks -ar
Attach to current taskbosh -d $deployment task -a
Get task by idbosh -d $deployment task $id
Get task detail msgbosh -d $deployment task $id --debug
Get all logs for a deploymentbosh -d $deployment logs
Get log for one vmbosh -d $deployment logs $instance_name
List bosh eventsbosh events

1.10 Bosh Job - Skeleton

NameCommand
ReferenceExample: kubo-release/jobs
providesExport resources for other bosh releases
consumesUse resources from other bosh releases
packagesPackages get installed by bosh
templatesConf files

1.11 Bosh Deployment

NameCommand
List bosh deploymentsbosh deployments
Show detail of one deploymentbosh -d $deployment deployment
Delete bosh deploymentbosh -n -d $deployment delete-deployment --force
Get deployment manifest yamlbosh -d $deployment manifest > my.yaml
Run bosh deployment from yamlbosh -d $deployment deploy my.yaml

1.12 Bosh vs Kubernetes

Bosh - VM Lifecycle ManagementKubernetes - Container Lifecycle Management
Bosh EnvsKubernetes Context
Bosh DeploymentKubernetes Deployment
Bosh StemcellDocker Image
Bosh ManifestKubernetes Configmap & Yaml
Bosh MonitKubernetes Kubelet
Bosh ErrandKubernetes Job
Bosh ReleaseKubernetes Chart
Bosh TileKubernetes Helm
Bosh DirectorKubernetes API server
Bosh EventKubernetes Event
Bosh Task
Bosh Agent
Bosh Addon
Bosh Ops managerNo related feature: UI to customize your service

1.13 Bosh Concepts List

NameComment
Bosh StemcellsA versioned Operating System image. Download stemcell
Bosh DeploymentAn encapsulation of software and configuration that BOSH can deploy to the cloud.
Bosh ReleaseEverything needed to make a software component deployable by BOSH.
Bosh JobEach release job represents a specific chunk of work that the release performs.
Bosh PackageIt contains vendored in software source and scripts to compile it.
Bosh ErrandA short-lived job that can be triggered by an operator any time after the deploy.
Bosh TileA *.pivotal file with everything needed to install/upgrade a PCF service. Tile CheatSheet
Bosh ManifestA YAML file that identifies one or more releases, stemcells and configurations
Bosh ops fileA YAML file that includes multiple operations to be applied to a different YAML file.
Bosh EventActions taken by the Director (via user or system control) are recorded as events
Bosh DirectorThe Director is the orchestrator of deployments.
Bosh AddonA release job that is colocated on all VMs managed by the Director.
Bosh AgentA process that runs continuously on each VM that BOSH deploys. one Agent process per VM
Bosh JumpboxA VM that acts as a single access point for the Director and deployed VMs.
Director BlobstoreA repository where BOSH stores release artifacts, logs, stemcells, and other content, etc
Cloud ID (CID)ID returned from the Cloud identifying particular resource such as VM or disk.

1.14 Bosh Stemcell

NameCommand
Floating stemcellFloating stemcells allow upgrade to the minor versions of stemcells but not the major versions.
Upload stemcellbosh -n upload-stemcell /tmp/stemcell.tgz
List stemcellsbosh -n stemcells
Delete a stemcellbosh delete-stemcell <stemcell-name>/<stemcell-version>

1.15 Bosh Monit

NameComment
List bosh deployed daemon processessudo su -, monit summary, watch 'monit summary'
Restart a given daemon processesmonit restart <process_name>
Check a given daemon processes statusmonit status <process_name>

1.16 Bosh Tools

NameComment
bbr bosh-backup-and-restoreA framework for backing up and restoring BOSH deployments and BOSH Directors.
bbl bosh-bootloaderA command line utility for standing up BOSH on multi-clouds
bpm BOSH process managerIsolation of BOSH jobs to make they run on many different work schedulers instead of monit only

1.17 Bosh Challenges

NameComment
Create deployment is very slowNeed to compile packages again, and canary update for all VMs
Errands on non co-located vmsIt takes 5+ minutes to spin up and destroy a VM
No repo mechanism for Bosh releasesDuplicate packages are required to make no external dependencies
Support tail -fPersonally I don’t like the way of bosh logs
Retry a failed errand/taskCurrently we can do it. But it’s a lengthy manual process
More lightweightUse containers, instead of VMs to run errands
Support rolling upgradeJust like kubectl rollout
More declarativeEnd users define requirements via yaml files

1.18 Online Help Usage

kubo@jumper:~$ bosh --help
Usage:
  bosh [OPTIONS] <command>

Application Options:
  -v, --version          Show CLI version
      --config=          Config file path (default: ~/.bosh/config) [$BOSH_CONFIG]
  -e, --environment=     Director environment name or URL [$BOSH_ENVIRONMENT]
      --ca-cert=         Director CA certificate path or value [$BOSH_CA_CERT]
      --sha2             Use SHA256 checksums [$BOSH_SHA2]
      --parallel=        The max number of parallel operations (default: 5)
      --client=          Override username or UAA client [$BOSH_CLIENT]
      --client-secret=   Override password or UAA client secret [$BOSH_CLIENT_SECRET]
  -d, --deployment=      Deployment name [$BOSH_DEPLOYMENT]
      --column=          Filter to show only given column(s)
      --json             Output as JSON
      --tty              Force TTY-like output
      --no-color         Toggle colorized output
  -n, --non-interactive  Don't ask for user input [$BOSH_NON_INTERACTIVE]

Help Options:
  -h, --help             Show this help message

Available commands:
  add-blob               Add blob                                           https://bosh.io/docs/cli-v2#add-blob
  alias-env              Alias environment to save URL and CA certificate   https://bosh.io/docs/cli-v2#alias-env
  attach-disk            Attaches disk to an instance                       https://bosh.io/docs/cli-v2#attach-disk
  blobs                  List blobs                                         https://bosh.io/docs/cli-v2#blobs
  cancel-task            Cancel task at its next checkpoint                 https://bosh.io/docs/cli-v2#cancel-task (aliases: ct)
  clean-up               Clean up releases, stemcells, disks, etc.          https://bosh.io/docs/cli-v2#clean-up
  cloud-check            Cloud consistency check and interactive repair     https://bosh.io/docs/cli-v2#cloud-check (aliases: cck, cloudcheck)
  cloud-config           Show current cloud config                          https://bosh.io/docs/cli-v2#cloud-config (aliases: cc)
  config                 Show current config for either ID or both type and name https://bosh.io/docs/cli-v2#config (aliases: c)
  configs                List configs                                       https://bosh.io/docs/cli-v2#configs (aliases: cs)
  cpi-config             Show current CPI config                            https://bosh.io/docs/cli-v2#cpi-config
  create-env             Create or update BOSH environment                  https://bosh.io/docs/cli-v2#create-env
  create-release         Create release                                     https://bosh.io/docs/cli-v2#create-release (aliases: cr)
  delete-config          Delete config                                      https://bosh.io/docs/cli-v2#delete-config (aliases: dc)
  delete-deployment      Delete deployment                                  https://bosh.io/docs/cli-v2#delete-deployment (aliases: deld)
  delete-disk            Delete disk                                        https://bosh.io/docs/cli-v2#delete-disk
  delete-env             Delete BOSH environment                            https://bosh.io/docs/cli-v2#delete-env
  delete-release         Delete release                                     https://bosh.io/docs/cli-v2#delete-release (aliases: delr)
  delete-snapshot        Delete snapshot                                    https://bosh.io/docs/cli-v2#delete-snapshot
  delete-snapshots       Delete all snapshots in a deployment               https://bosh.io/docs/cli-v2#delete-snapshots
  delete-stemcell        Delete stemcell                                    https://bosh.io/docs/cli-v2#delete-stemcell (aliases: dels)
  delete-vm              Delete VM                                          https://bosh.io/docs/cli-v2#delete-vm
  deploy                 Update deployment                                  https://bosh.io/docs/cli-v2#deploy (aliases: d)
  deployment             Show deployment information                        https://bosh.io/docs/cli-v2#deployment (aliases: dep)
  deployments            List deployments                                   https://bosh.io/docs/cli-v2#deployments (aliases: ds, deps)
  diff-config            Diff two configs by ID                             https://bosh.io/docs/cli-v2#diff-config
  disks                  List disks                                         https://bosh.io/docs/cli-v2#disks
  environment            Show environment                                   https://bosh.io/docs/cli-v2#environment (aliases: env)
  environments           List environments                                  https://bosh.io/docs/cli-v2#environments (aliases: envs)
  errands                List errands                                       https://bosh.io/docs/cli-v2#errands (aliases: es)
  event                  Show event details                                 https://bosh.io/docs/cli-v2#event
  events                 List events                                        https://bosh.io/docs/cli-v2#events
  export-release         Export the compiled release to a tarball           https://bosh.io/docs/cli-v2#export-release
  finalize-release       Create final release from dev release tarball      https://bosh.io/docs/cli-v2#finalize-release
  generate-job           Generate job                                       https://bosh.io/docs/cli-v2#generate-job
  generate-package       Generate package                                   https://bosh.io/docs/cli-v2#generate-package
  help                   Show this help message                             https://bosh.io/docs/cli-v2#help
  ignore                 Ignore an instance                                 https://bosh.io/docs/cli-v2#ignore
  init-release           Initialize release                                 https://bosh.io/docs/cli-v2#init-release
  inspect-release        List release contents such as jobs                 https://bosh.io/docs/cli-v2#inspect-release
  instances              List all instances in a deployment                 https://bosh.io/docs/cli-v2#instances (aliases: is)
  interpolate            Interpolates variables into a manifest             https://bosh.io/docs/cli-v2#interpolate (aliases: int)
  locks                  List current locks                                 https://bosh.io/docs/cli-v2#locks
  log-in                 Log in                                             https://bosh.io/docs/cli-v2#log-in (aliases: l, login)
  log-out                Log out                                            https://bosh.io/docs/cli-v2#log-out (aliases: logout)
  logs                   Fetch logs from instance(s)                        https://bosh.io/docs/cli-v2#logs
  manifest               Show deployment manifest                           https://bosh.io/docs/cli-v2#manifest (aliases: man)
  orphan-disk            Orphan disk                                        https://bosh.io/docs/cli-v2#orphan-disk
  recreate               Recreate instance(s)                               https://bosh.io/docs/cli-v2#recreate
  releases               List releases                                      https://bosh.io/docs/cli-v2#releases (aliases: rs)
  remove-blob            Remove blob                                        https://bosh.io/docs/cli-v2#remove-blob
  repack-stemcell        Repack stemcell                                    https://bosh.io/docs/cli-v2#repack-stemcell
  reset-release          Reset release                                      https://bosh.io/docs/cli-v2#reset-release
  restart                Restart instance(s)                                https://bosh.io/docs/cli-v2#restart
  run-errand             Run errand                                         https://bosh.io/docs/cli-v2#run-errand
  runtime-config         Show current runtime config                        https://bosh.io/docs/cli-v2#runtime-config (aliases: rc)
  scp                    SCP to/from instance(s)                            https://bosh.io/docs/cli-v2#scp
  snapshots              List snapshots                                     https://bosh.io/docs/cli-v2#snapshots
  ssh                    SSH into instance(s)                               https://bosh.io/docs/cli-v2#ssh
  start                  Start instance(s)                                  https://bosh.io/docs/cli-v2#start
  stemcells              List stemcells                                     https://bosh.io/docs/cli-v2#stemcells (aliases: ss)
  stop                   Stop instance(s)                                   https://bosh.io/docs/cli-v2#stop
  sync-blobs             Sync blobs                                         https://bosh.io/docs/cli-v2#sync-blobs
  take-snapshot          Take snapshot                                      https://bosh.io/docs/cli-v2#take-snapshot
  task                   Show task status and start tracking its output     https://bosh.io/docs/cli-v2#task (aliases: t)
  tasks                  List running or recent tasks                       https://bosh.io/docs/cli-v2#tasks (aliases: ts)
  unignore               Unignore an instance                               https://bosh.io/docs/cli-v2#unignore
  update-cloud-config    Update current cloud config                        https://bosh.io/docs/cli-v2#update-cloud-config (aliases: ucc)
  update-config          Update config                                      https://bosh.io/docs/cli-v2#update-config (aliases: uc)
  update-cpi-config      Update current CPI config                          https://bosh.io/docs/cli-v2#update-cpi-config
  update-resurrection    Enable/disable resurrection                        https://bosh.io/docs/cli-v2#update-resurrection
  update-runtime-config  Update current runtime config                      https://bosh.io/docs/cli-v2#update-runtime-config (aliases: urc)
  upload-blobs           Upload blobs                                       https://bosh.io/docs/cli-v2#upload-blobs
  upload-release         Upload release                                     https://bosh.io/docs/cli-v2#upload-release (aliases: ur)
  upload-stemcell        Upload stemcell                                    https://bosh.io/docs/cli-v2#upload-stemcell (aliases: us)
  variables              List variables                                     https://bosh.io/docs/cli-v2#variables (aliases: vars)
  vendor-package         Vendor package                                     https://bosh.io/docs/cli-v2#vendor-package
  vms                    List all VMs in all deployments                    https://bosh.io/docs/cli-v2#vms

Succeeded

1.19 More Resources

https://github.com/bosh-tips/tips

http://engineering.pivotal.io/post/compiled-releases-for-pipelines/

License: Code is licensed under MIT License.

linkedin github slack