This is a command-line interface (CLI) for interacting with Service Catalog
resources. svcat is a domain-specific tool to make interacting with the Service Catalog easier.
While many of its commands have analogs to kubectl
, our goal is to streamline and optimize
the operator experience.
svcat communicates with Kubernetes cluster by directly using REST API - just like kubectl.
This document assumes that you’ve installed Service Catalog and the Service Catalog CLI onto your cluster. If you haven’t, please see the installation instructions.
To use svcat as a kubectl plugin, run the following command after downloading:
$ svcat install plugin
Plugin has been installed to ~/.kube/plugins/svcat. Run kubectl plugin svcat --help for help using the plugin.
When operating as a plugin, the commands are the same with the addition of the global
kubectl configuration flags. One exception is that boolean flags aren’t supported
when running in plugin mode, so instead of using --flag
you must specify a value --flag=true
.
Run svcat --help
to see the available commands.
Below are some common tasks made easy with svcat. The example output assumes that the User Provided Service Broker is installed on the cluster.
$ svcat register ups-broker --url http://ups-broker-ups-broker.ups-broker.svc.cluster.local --scope cluster
Name: ups-broker
URL: https://ups-broker-ups-broker.ups-broker.svc.cluster.local
Status:
This lists all brokers available in the current namespace and at the cluster scope.
$ svcat get brokers
NAME NAMESPACE URL STATUS
+------------+-----------+-----------------------------------------------------------+--------+
ups-broker http://ups-broker-ups-broker.ups-broker.svc.cluster.local Ready
$ svcat sync broker ups-broker
Synchronization requested for broker: ups-broker
This lists all classes available in the current namespace and at the cluster scope.
$ svcat get classes
NAME NAMESPACE BROKER DESCRIPTION
+------------------------------------+-----------+------------+-------------------------+
user-provided-service ups-broker A user provided service
user-provided-service-single-plan ups-broker A user provided service
user-provided-service-with-schemas ups-broker A user provided service
$ svcat marketplace
CLASS PLANS DESCRIPTION
+------------------------------------+---------+-------------------------+
user-provided-service default A user provided service
premium
user-provided-service-single-plan default A user provided service
user-provided-service-with-schemas default A user provided service
$ svcat provision ups-instance --class user-provided-service --plan default
Name: ups-instance
Namespace: default
Status:
Class: user-provided-service
Plan: default
Parameters:
No parameters defined
Additional parameters and secrets can be provided using the --param
and --secret
flags:
--param p1=foo --param p2=bar --secret creds[db]
You can also provide provision parameters in the form of a JSON string using the --params-json
flag:
$ svcat provision secure-instance --class user-provided-service --plan premium --params-json '{
"encrypt" : true,
"firewallRules" : [
{
"name": "AllowSome",
"startIPAddress": "75.70.113.50",
"endIPAddress" : "75.70.113.131"
},
{
"name": "AllowMore",
"startIPAddress": "13.54.0.0",
"endIPAddress" : "13.56.0.0"
}
]
}
'
Name: secure-instance
Namespace: default
Status:
Class: user-provided-service
Plan: premium
Parameters:
encrypt: true
firewallRules:
- endIPAddress: 75.70.113.131
name: AllowSome
startIPAddress: 75.70.113.50
- endIPAddress: 13.56.0.0
name: AllowMore
startIPAddress: 13.54.0.0
Note: You may not combine the --params-json
flag with individual --param
flags.
$ svcat get instances
NAME NAMESPACE CLASS PLAN STATUS
+--------------+-----------+-----------------------+---------+--------+
ups-instance default user-provided-service default Ready
$ svcat bind ups-instance --name ups-binding
Name: ups-binding
Namespace: default
Status:
Secret: ups-binding
Instance: ups-instance
Parameters:
No parameters defined
When omitted, the names of the binding and secret are defaulted to the name of the instance.
$ svcat bind ups-instance
Name: ups-instance
Namespace: default
Status:
Instance: ups-instance
$ svcat describe instance ups-instance
Name: ups-instance
Namespace: default
Status: Ready - The instance was provisioned successfully @ 2018-11-01 18:31:16 +0000 UTC
Class: user-provided-service
Plan: default
Parameters:
No parameters defined
Bindings:
NAME STATUS
+-------------+--------+
ups-binding Ready
$ svcat unbind ups-instance
deleted ups-binding
$ svcat unbind --name ups-binding
deleted ups-binding
Deprovisioning is the process of preparing an instance to be removed, and then deleting it. You must unbind delete all bindings before deprovisioning an instance.
$ svcat deprovision ups-instance
deleted ups-instance
Deregistering is the process of removing a broker and its associated classes and plans from the cluster. You must delete all active instances of its classes before deregistering a broker.
$ svcat deregister ups-broker --scope cluster
Successfully removed broker "ups-broker"
svcat supports interaction with the namespaced versions of Service Catalog resources. The scope
flag is
used to indicate whether to execute the command in the cluster
, namespace
, or all
scope.
svcat registers/deregisters brokers as namespaced brokers in the namespace of your current context by default.
You can choose another namespace with the -n
flag.
$ svcat register ups-broker --url http://ups-broker-ups-broker.ups-broker.svc.cluster.local -n foobar
Name: ups-broker
URL: http://ups-broker-ups-broker.ups-broker.svc.cluster.local
Status:
svcat does not currently support provisioning instances of namespaced classes and plans.
svcat commands that get information about the current state of the system also support the --scope
flag, which is set
to all
by default. This will return all of the resources visible in the cluster scope, and the namespace of your current
context. In the following examples, helmbroker is installed as a cluster broker, while ups-broker
is installed in the
default
namespace.
$ svcat get brokers
NAME NAMESPACE URL STATUS
+------------+-----------+-----------------------------------------------------------+--------+
helmbroker http://helmbroker-helmbroker.helmbroker.svc.cluster.local Ready
ups-broker default http://ups-broker-ups-broker.ups-broker.svc.cluster.local Ready
$ svcat get brokers -n foobar
NAME NAMESPACE URL STATUS
+------------+-----------+-----------------------------------------------------------+--------+
helmbroker http://helmbroker-helmbroker.helmbroker.svc.cluster.local Ready
$ svcat get brokers --scope namespace
NAME NAMESPACE URL STATUS
+------------+-----------+-----------------------------------------------------------+--------+
ups-broker default http://ups-broker-ups-broker.ups-broker.svc.cluster.local Ready
svcat describe
does not currently support namespaced resources.