Catch up with previous entries in the series:
I will be using IBM Bluemix here as I have recent experience of it but nearly all of the concepts will be similar for any other cloud environment.
Deploying ClustersSo now we have docker images deployed into Bluemix. The next step is to actually deploy the images into a Kubernetes cluster. Firstly we need to create a cluster, then we need to actually deploy into it. For what we are doing here we need a standard paid cluster.
Preperation1. Log in to the Blue Mix CLI using you Blue Mix account credentials:
bx login -a https://api.ng.bluemix.net
2. Choose a location, you can view locations with:
bx cs locations
2. Choose machine type, you can view machine types for locations with:
bx cs machine-types dal10
3. Check for VLANS. You need to choose both a public and private VLAN for a standard cluster. It should look something like this:
bx cs vlans dal10
If you need to create them... init the SoftLayer CLI first:
bx sl init
Just select Single Sign On: (2)
You should be logged in and able to create vlans:
bx sl vlan create -t public -d dal10 -s 8 -n waynepublic
Note: Your Bluemix account needs permission to create VLANs, if you don't have this you need to contact support. You'll be told if this is the case. You should get one free public VLAN I believe.
Creating a Cluster1. Create a cluster:
Assuming you have public and private VLANs you can create a kubernetes cluster:
bx cs cluster-create --location dal10 --machine-type u1c.2x4 --workers 2 --name wbcluster --private-vlan 1638423 --public-vlan 2106869
You *should* also be able to use the Bluemix UI to create clusters.
2. You may need to wait a little while for the cluster to be deployed. You can check the status of it using:
bx cs clusters
During the deployment you will likely receive various emails from Bluemix confirming infrastructure has been provisioned.
3. When the cluster has finished deployment ( state is pending ), set the new cluster as the current context:
bx cs cluster-config wbcluster
The statement in yellow is the important bit, copy and paste that export back into the terminal to configure the environment for kubernetes to run.
4. Now you can run kubectl commands, view the cluster config with:
kubectl config view
See the kubernetes documentation for the full set of commands you can run, we will only be looking at a few key ones for now.
5. Clone (or download) the ForgeRock Kubernetes repo to somewhere local:
6. Navigate to the fretes directory:
7. We need to make a tweak to the fretes/helm/custom.yaml file and add the following:
This specified the type of storage we want our deployment to use in Bluemix. If it were AWS or Azure you may need something similar.
8. From the same terminal window that you have setup kubectl, navigate to the fretes/helm/ directory and run:
This will install the helm component into the cluster ready to process the helm scripts we are going to run.
9. Run the OpenAM helm script which will configure instances of AM, backed by DJ into our kubernetes cluster:
This script will take a while and again will trigger the provisioning of infrastructure, storage and other components resulting in emails from Bluemix. While this is happening you should see something like this:
If you have to re-deploy on subsequent occasions, the storage will not need to be re-provisioned and the whole process will be significantly faster. When it is all done you should see something like this:
10. Proxy the kube dash:
Navigate to http://127.0.0.1:8001/ui in a browser and you should see the kubernetes console!
Here you can see everything that has been deployed automatically using the helm script!
We have multiple instances of AM and DJ with storage deployed into Bluemix ready to configure!
In the next blog we will take a detailed look at the kubernetes dashboard to understand exactly what we have done, but for now lets take a quick look at one of our new AM instances.
11. Log in to AM:
Ctrl-C the proxy command and type the following:
bx cs workers wbcluster
You can see a list of our workers above, and the IP they have been exposed publicly on.
Note: There are defined ways of accessing applications using Kubernetes, typically you would use an ingress or a load balancer and not go directly using the public IP. We may look at these in later blogs.
As you probably know, AM expects a fully qualified domain name so before we can log in we need to edit /etc/hosts and add the following:
Then you can navigate to AM:
You should be able to login with amadmin/password!
So far in this series we have created docker containers with the ForgeRock components, uploaded these to Bluemix and run the orchestration helm script to actually deploy instances of these containers into a meaningful architecture. Not bad!
In the next blog we will take a detailed look at the kubernetes console and examine what has actually been deployed.