LATEST VERSION: v1.2 - RELEASE NOTES
Pivotal Container Service v1.2

PKS CLI

Page last updated:

This topic describes how to use the Pivotal Container Service Command Line Interface (PKS CLI) to interact with the PKS API.

The PKS CLI is used to create, manage, and delete Kubernetes clusters. To deploy workloads to a Kubernetes cluster created using the PKS CLI, use the Kubernetes CLI, kubectl.

Current Version: 1.2.0-build.43

pks cluster

View the details of the cluster

Synopsis

Run this command to see details of your cluster such as name, host, port, ID, number of worker nodes, last operation, etc.

pks cluster [flags]

Examples

  pks cluster my-cluster

Options

  -h, --help   help for cluster
      --json   Return the PKS-API output as json

pks clusters

Show all clusters created with PKS

Synopsis

This command describes the clusters created via PKS, and the last action taken on the cluster

pks clusters [flags]

Examples

  pks clusters

Options

  -h, --help   help for clusters
      --json   Return the PKS-API output as json

pks create-cluster

Creates a kubernetes cluster, requires cluster name, an external host name, and plan

Synopsis

Create-cluster requires a cluster name, as well as an external hostname and plan. External hostname can be a loadbalancer, from which you access your kubernetes API (aka, your cluster control plane)

pks create-cluster <cluster-name> [flags]

Examples

  pks create-cluster my-cluster --external-hostname example.hostname --plan production

Options

  -e, --external-hostname string   Address from which to access Kubernetes API
  -h, --help                       help for create-cluster
      --json                       Return the PKS-API output as json
      --network-profile string     Optional, network profile name (NSX-T only)
      --non-interactive            Don't ask for user input
  -n, --num-nodes string           Number of worker nodes
  -p, --plan string                Preconfigured plans. Run pks plans for more details
      --wait                       Wait for the operation to finish

pks create-network-profile

Create a network profile

Synopsis

Create network profile requires a path to the profile JSON file (Only applicable for NSX-T)

pks create-network-profile <network-profile-JSON-path> [flags]

Examples

  pks create-network-profile my-network-profile.json

Options

  -h, --help   help for create-network-profile

pks delete-cluster

Deletes a kubernetes cluster, requires cluster name

Synopsis

Delete-cluster requires a cluster name.

pks delete-cluster <cluster-name> [flags]

Examples

  pks delete-cluster my-cluster

Options

  -h, --help              help for delete-cluster
      --non-interactive   Don't ask for user input
      --wait              Wait for the operation to finish

pks delete-network-profile

Delete a network profile

Synopsis

Deletes network profile. Requires a network profile name (Only applicable for NSX-T). Cannot be deleted if in use

pks delete-network-profile PROFILE_NAME [flags]

Examples

 pks delete-network-profile my-network-profile

Options

  -h, --help              help for delete-network-profile
      --non-interactive   Don't ask for user input

pks get-credentials

Allows you to connect to a cluster and use kubectl

Synopsis

Run this command in order to update a kubeconfig file so you can access the cluster through kubectl

pks get-credentials <cluster-name> [flags]

Examples

  pks get-credentials my-cluster

Options

  -h, --help   help for get-credentials

pks login

Log in to PKS

Synopsis

The login command requires -a to target the IP of your PKS API, -u for username and -p for password

pks login [flags]

Examples

  pks login -a <API> -u <USERNAME> -p <PASSWORD> [--ca-cert <PATH TO CERT> | -k]

  pks login -a <API> --client-name <CLIENT NAME> --client-secret <CLIENT SECRET> [--ca-cert <PATH TO CERT> | -k]

Options

  -a, --api string              The PKS API server URI
      --ca-cert string          Path to CA Cert for PKS API
      --client-name string      Client name
      --client-secret string    Client secret
  -h, --help                    help for login
  -p, --password string         Password
  -k, --skip-ssl-validation     Skip SSL Validation
      --skip-ssl-verification   Skip SSL Verification (DEPRECATED: use --skip-ssl-validation)
  -u, --username string         Username

pks logout

Log out of PKS

Synopsis

Log out of PKS. Does not remove kubeconfig credentials or kubectl access.

pks logout [flags]

Examples

  pks logout 

Options

  -h, --help   help for logout

pks network-profiles

Show all network profiles created with PKS

Synopsis

Lists and describes network profiles

pks network-profiles [flags]

Examples

  pks network-profiles

Options

  -h, --help   help for network-profiles
      --json   Return the PKS-API output as json

pks plans

View the preconfigured plans available

Synopsis

This command describes the preconfigured plans available

pks plans [flags]

Examples

  pks plans

Options

  -h, --help   help for plans
      --json   Return the PKS-API output as json

pks resize

Increases the number of worker nodes for a cluster

Synopsis

Resize requires a cluster name, and the number of desired worker nodes. Users can only scale UP clusters, to a maximum of 50 worker nodes and not scale down

pks resize <cluster-name> [flags]

Examples

  pks resize my-cluster --num-nodes 5

Options

  -h, --help              help for resize
      --json              Return the PKS-API output as json. Only applicable when used with --wait flag
      --non-interactive   Don't ask for user input
  -n, --num-nodes int32   Number of worker nodes (default 1)
      --wait              Wait for the operation to finish

Please send any feedback you have to pks-feedback@pivotal.io.

Create a pull request or raise an issue on the source for this page in GitHub