|
| 1 | +# Service Catalog CLI |
| 2 | + |
| 3 | +This is a command-line interface (CLI) for interacting with |
| 4 | +[Kubernetes Service Catalog](../../README.md) |
| 5 | +resources. svcat is a domain-specific tool to make interacting with the Service Catalog easier. |
| 6 | +While many of its commands have analogs to `kubectl`, our goal is to streamline and optimize |
| 7 | +the operator experience, contributing useful code back upstream to Kubernetes where applicable. |
| 8 | + |
| 9 | +svcat communicates with the Service Catalog API through the [aggregated API][agg-api] endpoint on a |
| 10 | +Kubernetes cluster. |
| 11 | + |
| 12 | +[agg-api]: https://kubernetes.io/docs/concepts/api-extension/apiserver-aggregation/ |
| 13 | + |
| 14 | +# Prerequisites |
| 15 | +In order to use svcat, you will need: |
| 16 | + |
| 17 | +* A Kubernetes cluster running v1.7+ or higher |
| 18 | +* A broker compatible with the Open Service Broker API installed on the cluster, such as: |
| 19 | + * [User Provided Service Broker](../../charts/ups-broker) |
| 20 | + * [Open Service Broke for Azure](https://github.com/Azure/helm-charts/tree/master/open-service-broker-azure) |
| 21 | +* The [Service Catalog](../../docs/install.md) installed on the cluster. |
| 22 | + |
| 23 | +# Install |
| 24 | +Follow the appropriate instructions for your shell to download svcat. The binary |
| 25 | +can be used by itself, or as kubectl plugin. |
| 26 | + |
| 27 | +## Bash |
| 28 | +``` |
| 29 | +curl -sLO https://servicecatalogcli.blob.core.windows.net/cli/latest/$(uname -s)/$(uname -m)/svcat |
| 30 | +chmod +x ./svcat |
| 31 | +mv ./svcat /usr/local/bin/ |
| 32 | +svcat --version |
| 33 | +``` |
| 34 | + |
| 35 | +## PowerShell |
| 36 | + |
| 37 | +``` |
| 38 | +iwr 'https://servicecatalogcli.blob.core.windows.net/cli/latest/Windows/x86_64/svcat.exe' -UseBasicParsing -OutFile svcat.exe |
| 39 | +mkdir -f ~\bin |
| 40 | +$env:PATH += ";${pwd}\bin" |
| 41 | +svcat --version |
| 42 | +``` |
| 43 | + |
| 44 | +The snippet above adds a directory to your PATH for the current session only. |
| 45 | +You will need to find a permanent location for it and add it to your PATH. |
| 46 | + |
| 47 | +## Manual |
| 48 | +1. Download the appropriate binary for your operating system: |
| 49 | + * macOS: https://servicecatalogcli.blob.core.windows.net/cli/latest/Darwin/x86_64/svcat |
| 50 | + * Windows: https://servicecatalogcli.blob.core.windows.net/cli/latest/Windows/x86_64/svcat.exe |
| 51 | + * Linux: https://servicecatalogcli.blob.core.windows.net/cli/latest/Linux/x86_64/svcat |
| 52 | +1. Make the binary executable. |
| 53 | +1. Move the binary to a directory on your PATH. |
| 54 | + |
| 55 | +## Plugin |
| 56 | +To use svcat as a plugin, run the following command after downloading: |
| 57 | + |
| 58 | +```console |
| 59 | +$ ./svcat install plugin |
| 60 | +Plugin has been installed to ~/.kube/plugins/svcat. Run kubectl plugin svcat --help for help using the plugin. |
| 61 | +``` |
| 62 | + |
| 63 | +When operating as a plugin, the commands are the same with the addition of the global |
| 64 | +kubectl configuration flags. One exception is that boolean flags aren't supported |
| 65 | +when running in plugin mode, so instead of using `--flag` you must specify a value `--flag=true`. |
| 66 | + |
| 67 | + |
| 68 | +# Use |
| 69 | + |
| 70 | +Run `svcat -h` to see the available commands. |
| 71 | + |
| 72 | +Below are some common tasks made easy with svcat. The example output assumes that [User Provided Service Broker](../../charts/ups-broker) is installed on the cluster. |
| 73 | + |
| 74 | +## Find brokers installed on the cluster |
| 75 | + |
| 76 | +```console |
| 77 | +$ svcat get brokers |
| 78 | + NAME URL STATUS |
| 79 | ++------------+-----------------------------------------------------------+--------+ |
| 80 | + ups-broker http://ups-broker-ups-broker.ups-broker.svc.cluster.local Ready |
| 81 | +``` |
| 82 | + |
| 83 | +## Trigger a sync of a broker's catalog |
| 84 | + |
| 85 | +```console |
| 86 | +$ svcat sync broker ups-broker |
| 87 | +Successfully fetched catalog entries from the ups-broker broker |
| 88 | +``` |
| 89 | + |
| 90 | +## List available service classes |
| 91 | + |
| 92 | +```console |
| 93 | +$ svcat get classes |
| 94 | + NAME DESCRIPTION UUID |
| 95 | ++-----------------------+-------------------------+--------------------------------------+ |
| 96 | + user-provided-service A user provided service 4f6e6cf6-ffdd-425f-a2c7-3c9258ad2468 |
| 97 | +``` |
| 98 | + |
| 99 | +## View service plans associated with a class |
| 100 | + |
| 101 | +```console |
| 102 | +$ svcat describe class user-provided-service |
| 103 | + Name: user-provided-service |
| 104 | + Description: A user provided service |
| 105 | + UUID: 4f6e6cf6-ffdd-425f-a2c7-3c9258ad2468 |
| 106 | + Status: Active |
| 107 | + Tags: |
| 108 | + Broker: ups-broker |
| 109 | + |
| 110 | +Plans: |
| 111 | + NAME DESCRIPTION |
| 112 | ++---------+-------------------------+ |
| 113 | + default Sample plan description |
| 114 | + premium Premium plan |
| 115 | +``` |
| 116 | + |
| 117 | +## Provision a service |
| 118 | + |
| 119 | +```console |
| 120 | +$ svcat provision -n test-ns ups-instance --class user-provided-service --plan default |
| 121 | + Name: ups-instance |
| 122 | + Namespace: test-ns |
| 123 | + Status: |
| 124 | + Class: user-provided-service |
| 125 | + Plan: default |
| 126 | +``` |
| 127 | + |
| 128 | +Additional parameters and secrets can be provided using the `--param` and `--secret` flags: |
| 129 | + |
| 130 | +``` |
| 131 | +--param p1=foo --param p2=bar --secret creds[db] |
| 132 | +``` |
| 133 | + |
| 134 | +## View all instances of a service plan on the cluster |
| 135 | + |
| 136 | +```console |
| 137 | +$ svcat describe plan premium |
| 138 | + Name: premium |
| 139 | + Description: Premium plan |
| 140 | + UUID: cc0d7529-18e8-416d-8946-6f7456acd589 |
| 141 | + Status: Active |
| 142 | + Free: false |
| 143 | + Class: user-provided-service |
| 144 | + |
| 145 | +Instances: |
| 146 | + NAME NAMESPACE STATUS |
| 147 | ++--------------+-----------+--------+ |
| 148 | + ups-instance test-ns Ready |
| 149 | +``` |
| 150 | + |
| 151 | +## List all service instances in a namespace |
| 152 | + |
| 153 | +```console |
| 154 | +$ svcat get instances -n test-ns |
| 155 | + NAME NAMESPACE CLASS PLAN STATUS |
| 156 | ++--------------+-----------+-----------------------+---------+--------+ |
| 157 | +ups-instance test-ns user-provided-service default Ready |
| 158 | +``` |
| 159 | + |
| 160 | +## Bind an instance |
| 161 | + |
| 162 | +```console |
| 163 | +$ svcat bind -n test-ns ups-instance --name ups-binding |
| 164 | + Name: ups-binding |
| 165 | + Namespace: test-ns |
| 166 | + Status: |
| 167 | + Instance: ups-instance |
| 168 | +``` |
| 169 | + |
| 170 | +When omitted, the names of the binding and secret are defaulted to the name of the instance. |
| 171 | + |
| 172 | +```console |
| 173 | +$ svcat bind ups |
| 174 | + Name: ups |
| 175 | + Namespace: default |
| 176 | + Status: |
| 177 | + Instance: ups |
| 178 | +``` |
| 179 | + |
| 180 | +## View the details of a service instance |
| 181 | + |
| 182 | +```console |
| 183 | +$ svcat describe instance -n test-ns ups-instance |
| 184 | + Name: ups-instance |
| 185 | + Namespace: test-ns |
| 186 | + Status: Ready - The instance was provisioned successfully @ 2018-01-11 14:59:47 -0600 CST |
| 187 | + Class: user-provided-service |
| 188 | + Plan: default |
| 189 | + |
| 190 | +Bindings: |
| 191 | + NAME STATUS |
| 192 | ++-------------+--------+ |
| 193 | + ups-binding Ready |
| 194 | +``` |
| 195 | + |
| 196 | +## Unbind all applications from an instance |
| 197 | +``` |
| 198 | +svcat unbind -n test-ns ups-instance |
| 199 | +``` |
| 200 | + |
| 201 | +## Unbind a single application from an instance |
| 202 | +``` |
| 203 | +svcat unbind -n test-ns --name ups-binding |
| 204 | +``` |
| 205 | + |
| 206 | +## Delete a service instance |
| 207 | +Deprovisioning is the process of preparing an instance to be removed, and then deleting it. |
| 208 | + |
| 209 | +``` |
| 210 | +svcat deprovision ups-instance |
| 211 | +``` |
0 commit comments