Skip to content

Instantly share code, notes, and snippets.

@alexandreroman
Last active October 25, 2018 14:23
Show Gist options
  • Save alexandreroman/f8e8701f69bf63a7b5594b0ecbd5a25d to your computer and use it in GitHub Desktop.
Save alexandreroman/f8e8701f69bf63a7b5594b0ecbd5a25d to your computer and use it in GitHub Desktop.
PKS cookbook

PKS cookbook

You need to setup PKS API access by creating a user. Make sure the VM hosting PKS Control Plane (PKS API Endpoint) is publicly available.

Login to PKS:

$ pks login -a <PKS API Endpoint> -u <User> -p <Password> --ca-cert <Path to Root Certificate>

Create a cluster:

$ pks create-cluster <Cluster Name> --external-hostname <Master Address> --plan <Plan Name: small, medium, large>

Monitor cluster creation:

$ pks cluster <Cluster Name>
Name:                     <Cluster Name>
Plan Name:                small
UUID:                     61d180a1-24bb-45ca-9c77-ae3741c60244
Last Action:              CREATE
Last Action State:        succeeded
Last Action Description:  Instance provisioning completed
Kubernetes Master Host:   <Master Address>
Kubernetes Master Port:   8443
Worker Nodes:             3
Kubernetes Master IP(s):  192.168.20.15
Network Profile Name:

Cluster creation can take up to 20 minutes. Cluster UUID may be used for BOSH commands: look for a deployment name containing this UUID.

Make sure to expose the VM hosting the master to a public address (port 8443) using a load balancer.

Before accessing the cluster, you need to retrieve credentials:

$ pks get-credentials <Cluster Name>

Fetching credentials for cluster <Cluster Name>.
Context set for cluster <Cluster Name>.

You can now switch between clusters by using:
$kubectl config use-context <cluster-name>

The file $HOME/.kube/config is created. You may use this file to access the Kubernetes dashboard:

$ kubectl proxy
Starting to serve on 127.0.0.1:8001

Access the Kubernetes dashboard using your browser: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

Connect to the dashboard using the local file $HOME/.kube/config:

Explore Kubernetes dashboard, and monitor cluster execution:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment