-
Notifications
You must be signed in to change notification settings - Fork 10
Lab 1: Setup & Config
The wiki has instructions for the Hands-on exercises that will be conducted during the Workshop. We will be using VMware Cloud PKS for the labs. VMware Cloud PKS already has Kubernetes clusters pre-provisioned for this workshop. You have been assigned to a pre-provisioned cluster in VMware Cloud PKS. The clusters will be available 24 hours after the workshop if you need to continue working on them.
- By now you should have an invitation email to login to VMware Cloud PKS, please follow instructions in the email to sign-up as a user
- In order to register for VMware Cloud PKS, you will need to have a login in 'My VMware'. If you already have a login in 'My VMware' using the same email address you used for registration you don't have to create a new one. Else, you will be directed to create a 'My VMware' ID.
- One of the Proctors for the Workshop should have assigned you a Kubernetes Cluster that's already pre-created and assigned to you, please have the cluster name handy.
- If you haven't received the invitation email or do not know the name of the Kubernetes Cluster assigned to you, please reach out to one of the proctors.
The VCP CLI will help us interact with the platform, fetch us the tokens needed to get authenticated access to the Kubernetes cluster
Note: VMware Cloud PKS (VCP) was formerly called VMware Kubernetes Engine(VKE). We are working through changes, you might still see 'VKE' used in the CLI and the URL to the service
- In a browser, launch the VMware Cloud Services console. https://console.cloud.vmware.com/
- Log in to your VMware Cloud services organization.
- On the VMware Cloud PKS tile, click Open. This takes you to the VMware Cloud PKS console.
- Click on 'Developer Center', once there click the text 'DOWNLOAD THE VCP CLI'. Click on 'Downloads' and select the version based on the operating system you are working on.
- Also on the same page, download
kubectl
by clicking the download button under the kubectl tile. - After the download completes, move the vke executable to a common bin directory (for example, ~/bin or %UserProfile%\bin).
- For Linux or Mac OS X:
% mkdir ~/bin
% cp vke ~/bin
- For Windows:
mkdir %UserProfile%\bin
copy vke.exe %UserProfile%\bin
- Make sure your bin directory is accessible on your PATH.
- For Linux or Mac OS X:
% export PATH=$PATH:/Users/your-user-name/bin
- For Windows:
set PATH=%PATH%;%UserProfile%\bin
- Make the file executable.
- For Linux or Mac OS X:
% chmod +x ~/bin/vke
- For Windows:
attrib +x %UserProfile%\bin\vke.exe
- Now change to a different directory and check the version to verify that the CLI is ready to use.
vke --version
Kubectl
is a command line interface for Kubernetes, it lets you interact with the Kubernetes cluster. Once logged in to the cluster Kubectl will be used anytime you want to deploy apps/services/provision storage etc. or need to query the cluster for existing pods/nodes/apps/services etc.
Kubectl is also available to download from the VCP Console page, once logged in to the console, Click on Developer-->click on -->Actions -->Download kubectl
Once downloaded, save the file in your environment for you to be able to access it from any directory. Just like the vke CLI above.
You can also interact with Kubernetes using the kubernetes dashboard if you prefer UI over CLI, the Kubernetes dashboard is available from the VCP console-->Your-Cluster-Name>-->Actions-->Open K8's UI
So far we have downloaded the vke CLI and kubectl CLI, now we will log in to VKE via the CLI to fetch the access tokens needed to talk to the clusters hosted in VKE via Kubectl
Get access to the Organization ID and Refresh Tokens
-
Go back to the VCP web interface Click on 'Developer Center' and click the Overview tab, once there you will see the CLI to login to VKE with the organization ID, copy the entire command line and store it in a note pad.
-
On the same page, click on 'Get your Refresh Token', this will redirect the browser to the 'My Accounts' page and you will see your OAuth Refresh Token, copy the token. If there is no token click "Generate Key" and copy it. Save the 'refresh token'
Please treat this Refresh Token as your Password and DO NOT SHARE it with others
Login using the Organization ID and Refresh Token
- Login to VCP, copy paste the VKE Login command from above (step1) and replace 'your-refresh-token' with the one you retrieved above (step 2)(omit the quotes).
vke account login -t 'your-organization-id' -r 'your-refresh-token'
- Set folder and project within VKE
vke folder set SharedFolder
vke project set SharedProject
- Fetch Kubectl auth for your cluster, replace with the name of the cluster assigned to you in the command below
vke cluster auth setup <your-cluster-name>
You should now be able to interact with your cluster using kubectl, give kubectl a try, run below commands to see your cluster Pods and Services
-
kubectl get pods
- Fetches the pods currently deployed in the cluster. -
kubectl get svc
- Fetches the various services currently created in the cluster.