Pivotal Container Service v1.0

Create a Cluster

Follow the steps below to create a Kubernetes cluster using the PKS CLI.

  1. Locate the external hostname for accessing the Kubernetes API. Use one of the following methods, depending on your PKS installation:

    • If your PKS installation is integrated with NSX-T, use the NAT IP from the ip-pool-vips NSX IP pool. For more information, see Enable NAT Access in Installing and Configuring PKS with NSX-T Integration.
    • If your PKS installation is not integrated with NSX-T, create an external load balancer and record its IP address or hostname. Each new cluster requires its own TCP or HTTPS load balancer to allow external access. When you provide the external hostname later in this procedure, you can either use the load balancer IP address or a hostname from the domain you specified for the PKS API. For more information, see the PKS API section of Installing and Configuring PKS on GCP or vSphere.
  2. Grant cluster access to a new or existing user in UAA. See the Grant Cluster Access to a User section of Manage Users in UAA for more information.

  3. On the command line, run the following command to log in:

    pks login -a PKS_API -u USERNAME -p PASSWORD --ca-cert CERT-PATH
    See Log in to the PKS CLI for more information about the pks login command.

  4. Run the following command to create a cluster:

    pks create-cluster CLUSTER-NAME --external-hostname HOSTNAME --plan PLAN-NAME [--num-nodes WORKER-NODES]
    Replace the placeholder values in the command as follows:

    • CLUSTER-NAME is a unique name for your cluster.
    • HOSTNAME is the external hostname for accessing the Kubernetes API. Use the hostname you located earlier in this procedure.
    • PLAN-NAME is the name of the plan you want to use to create the cluster.
    • WORKER-NODES is the number of worker nodes for the cluster. For high availability, Pivotal recommends creating clusters with at least 3 worker nodes. The maximum value is 50. This flag is optional.

      For example:
      $ pks create-cluster my-cluster --external-hostname --plan large --num-nodes 3
  5. Track the cluster creation process by running pks cluster CLUSTER-NAME. Replace CLUSTER-NAME with the unique name for your cluster. For example:

    $ pks cluster my-cluster
    The cluster status appears in the Last Action State column. If the last action state is error, troubleshoot cluster creation by logging in to the BOSH Director and running bosh tasks. See Advanced Troubleshooting with the BOSH CLI for more information.

  6. When cluster creation is complete, configure the external hostname.

    1. Run pks cluster CLUSTER-NAMEto view cluster details. Replace CLUSTER-NAME with the unique name for your cluster. For example:
      $ pks cluster my-cluster
    2. Locate the master IP address for the cluster in the kubernetes_master_ips row.
    3. Configure your external TCP or HTTPS load balancer to point to the master IP address.
  7. To access your cluster, run pks get-credentials CLUSTER-NAME. This command creates a local kubeconfig that allows you to manage the cluster. See Retrieve Cluster Credentials and Configuration for more information.

  8. Run kubectl cluster-info to confirm you can access your cluster using the Kubernetes CLI.

See Managing PKS for information about checking cluster health and viewing cluster logs.

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