Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 4.19 KB

lab_cli.adoc

File metadata and controls

80 lines (58 loc) · 4.19 KB

PKS Workshop Lab 1

This is a sample SpringBoot application that performs Geo Bounded queries against an Elastic Search instance and plots the data on a map interactively. This application can be run on a workstation or in a cloud environment such as Cloud Foundry. In this example, I will show how to deploy the application on a running Cloud Foundry instance.

1. Install and Setup CLIs

Install PKS CLI

In order to install the PKS CLI please follow these instructions: https://docs.pivotal.io/runtimes/pks/1-3/installing-pks-cli.html. Note, you will need to register with network.pivotal.io in order to download the CLI.

Alternatively, you can grab it here.

Install kubectl CLI

You can install the kubectl CLI from PivNet as well, or grab it here https://network.pivotal.io/products/pivotal-container-service

What you download is the executable. After downloading, rename the file to kubectl, move it to where you like and make sure it’s in your path.

For reference, here are some other ways to install, https://kubernetes.io/docs/tasks/tools/install-kubectl

2. Cluster Access and Validation

Get Cluster Credentials

You will need to retrieve the cluster credentials from PKS. First login using the the PKS credentials that were provided to you for this lab exercise.

 pks login -a api.ws.pks101.com -u USERNAME -p PASSWORD -k

Now you can retrive your Kubernetes cluster credentials. Please use the cluster name that was provided to you for this lab exercise.

 pks get-credentials CLUSTER-NAME

Validating your Cluster

Ensure that you can access the API Endpoints on the Master

 kubectl cluster-info

You should see something similar to the following:

Kubernetes master is running at https://wscluster.ws.pks101.com:8443
Heapster is running at https://wscluster.ws.pks101.com:8443/api/v1/namespaces/kube-system/services/heapster/proxy
KubeDNS is running at https://wscluster.ws.pks101.com:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
kubernetes-dashboard is running at https://wscluster.ws.pks101.com:8443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
monitoring-influxdb is running at https://wscluster.ws.pks101.com:8443/api/v1/namespaces/kube-system/services/monitoring-influxdb/proxy

Accessing the Dashboard

To access Dashboard from your local workstation you must create a secure channel to your Kubernetes cluster. Run the following command:

 kubectl proxy

Now access Dashboard at:

When prompted for choosing either the Kubeconfig or Token, choose Kubeconfig. You will need to browse to HOME-DIR/.kube and select the file named config.

On Windows, you may want to use Firefox or Chrome as Explorer has some issues.

If for some reason you are not able to pick the config file, you can also use Token. Find id-token of your user from HOME-DIR/.kube/config file and copy paste the token.

Setting the namespace preference

You can permanently save the namespace for all subsequent kubectl commands in that context.

$ kubectl config set-context $(kubectl config current-context) --namespace=YOUR-NAMESPACE
# Validate it
$ kubectl config view | grep namespace: