Getting Started with Kubernetes

Try out the API Portal on Kubernetes in the following simple steps.


Introduction

This page contains the instructions to run a demo portal on a Kubernetes minikube cluster; to see this for a local Docker host, please see the Getting Started With Docker guide.

This introduction to the API Portal we provide will guide you to deploy an API Portal like the one we keep for demo purposes at wicked-demo.haufe.io, on a Kubernetes cluster.

The wicked API Portal is designed to run within docker, and is specifically now targeting Kubernetes as the preferred runtime environment. The following short tutorial assumes you are familiar with Kubernetes, and that you have a local minikube environment up and running on your local machine.

Further, it's assumed that you are familiar in using a bash type shell, and that you have a running git installation. On Linux/Mac OS X this should be present out of the box (if you are a developer). On Windows, using either the Ubuntu bash Windows subsystem, or plain "Git bash" (cygwin) should work fine.

Note: The following guide is not suitable as a starting point for your own configuration, but is rather meant as a demo configuration. The documentation contains more information on how to get you started with your own APIs.

 

 

Step 1: Prerequisites - Minikube and Helm

Please make sure you have runnning minikube installation before you proceed with the next steps of this tutorial. Refer to the homepage of the minikube project on Github for more information on how to install:

Minikube on GitHub

Enable the "ingress addon" for minikube to be able to use the built-in ingress controller:

$ minikube addons enable ingress

Please also install Kubernetes Helm, which is the package manager for Kubernetes.

Helm Installation (on GitHub)

Make sure Helm (the tiller) is installed on your cluster by running

$ helm init


Step 2: Fetch the Helm Chart

Deploying the API Portal is equivalent to install a Helm Chart to your local minikube Kubernetes cluster. You can always find the Chart release on Github, or you can use the following script to download the latest version (for production use, please always use a specific version and upgrade manually):

$ curl -L http://wicked.haufe.io/get-wicked.sh | bash

This command downloads the latest version of the wicked Helm Chart to a local directory wicked so that it can be used with the configured cluster and Helm:

$ helm install --set minikubeIP=$(minikube ip) --name test wicked

The installation process takes a little while, as the images need to be downloaded and run on your cluster; by opening a different terminal instance and calling kubectl get pods, you can check on the status of the provisioning.

After around 2-5 minutes, depending on your bandwidth, you will presented the installation notes from Helm.

 

 

Step 3: Create /etc/hosts entries

 

Issue the following command to retrieve the IP address of your minikube VM's IP:

$ minikube ip
192.168.64.2 # example value

Open up your /etc/hosts (Linux/Mac OS X, on Windows: C:\Windows\System32\drivers\etc\hosts) file in an editor (this step will be different on Linux, Mac OS X and Windows, please google if unclear) and add the following line:

(output of minikube ip)   portal.local,api.portal.local

Note: You may need to sudo to change that file; on Windows you will need to edit the hosts file as Administrator.

 

Step 4: Log in

 

Using Chrome or Firefox, navigate to your API Portal at https://portal.local and start playing around. The sample configuration has a preconfigured admin user with the following credentials:

  • User email: admin@foo.com
  • Password: wicked

Note: Due to restrictions with saving Cookies with self signed certificates, this process may not work with all browsers. When installed with correct and valid certificates, wicked will work with all recent common browsers (Microsoft Edge, Firefox, Chrome and Safari).

 

Screenshot

Read more in the documentation, e.g. on how to use the sample portal.

To stop and deallocate the local API Portal, issue the following command:

$ kubectl delete job test-wicked-post-install # in future, this will be auto-removed by Helm
$ helm delete test --purge

Or, simply deprovision the minikube cluster (minikube delete).


Back to top

© 2016-2017 Haufe-Lexware GmbH & Co. KG, www.haufe-lexware.com, www.haufe.de, www.lexware.de, www.haufe-akademie.de