These Kubernetes Artifacts provide the resources and instructions to deploy WSO2 Enterprise Service Bus on Kubernetes.
In the context of this document,
KUBERNETES_HOME
,DOCKERFILES_HOME
andPUPPET_HOME
will refer to local copies ofwso2/kubernetes artifacts
,wso2/dockcerfiles
andwso2/puppet modules
repositories respectively.
To deploy WSO2 Enterprise Service Bus on Kubernetes, the following steps have to be done.
- Build WSO2 Enterprise Service Bus Docker images
- Copy the images to the Kubernetes Nodes
- Run
deploy.sh
which will deploy the Service and the Replication Controllers
To manage configurations and artifacts when building Docker images, WSO2 recommends to use wso2/puppet modules
as the provisioning method. A specific data set for Kubernetes platform is available in WSO2 Puppet Modules. It's possible to use this data set to build Dockerfiles for WSO2 Enterprise Service Bus for Kubernetes with minimum configuration changes.
Building WSO2 Enterprise Service Bus Docker images using Puppet for Kubernetes:
- Clone
wso2/puppet modules
andwso2/dockerfiles
repositories (alternatively you can download the released artifacts using the release page of the GitHub repository). - Copy the
kubernetes-membership-scheme-1.0.0.jar
toPUPPET_HOME/modules/<product>/files/configs/repository/components/dropins
location and apply relevant Kernel patches for clustering. - Copy the JDK
jdk-7u80-linux-x64.tar.gz
toPUPPET_HOME/modules/wso2base/files
location. - Copy the
mysql-connector-java-5.1.36-bin.jar
file toPUPPET_HOME/modules/wso2esb/files/configs/repository/components/lib
location. - Copy the WSO2 Enterprise Service Bus 4.9.0 product pack file to
PUPPET_HOME/modules/wso2esb/files
location (Note that if you use a different product version, the-v
flag provided to the subsequent scripts have to be changed to match). - Set the environment variable
PUPPET_HOME
pointing to location of the puppet modules in local machine. - Navigate to
wso2esb
directory in the Dockerfiles repository;DOCKERFILES_HOME/wso2esb
. - Build the Dockerfile with the following command:
- Copy
kernel patch0005
toPUPPET_HOME/modules/wso2esb/files/patches/repository/components/patches
folder.
**`./build.sh -v 4.9.0 -s kubernetes`**
Note that -s kubernetes
flag denotes the Kubernetes platform, when it comes to selecting the configuration from Puppet.
This will build the default profile of WSO2 Enterprise Service Bus 4.9.0 for Kubernetes platform, using configuration specified in Puppet.
Copy the required Docker images over to the Kubernetes Nodes (ex: use docker save
to create a tarball of the required image, scp
the tarball to each node, and use docker load
to reload the images from the copied tarballs on the nodes). Alternatively, if a private Docker registry is used, transfer the images there.
You can make use of the load-images.sh
helper script to transfer images to the Kubernetes nodes. It will search for any Docker images with wso2
as a part of its name on your local machine, and ask for verification to transfer them to the Kubernetes nodes. kubectl
has to be functioning on your local machine in order for the script to retrieve the list of Kubernetes nodes. You can optionally provide a search pattern if you want to override the default wso2
string.
load-images.sh -p wso2esb
Usage
Usage: ./load-images.sh [OPTIONS]
Transfer Docker images to Kubernetes Nodes
Options:
-u [OPTIONAL] Username to be used to connect to Kubernetes Nodes. If not provided, default "core" is used.
-p [OPTIONAL] Optional search pattern to search for Docker images. If not provided, default "wso2" is used.
-h [OPTIONAL] Show help text.
Ex: ./load-images.sh
Ex: ./load-images.sh -u ubuntu
Ex: ./load-images.sh -p wso2is
- Navigate to
wso2esb
directory in kubernetes repository;KUBERNETES_HOME/wso2esb
location. - run the deploy.sh script:
**`./deploy.sh`**
This will deploy the WSO2 Enterprise Service Bus 4.9.0 default profile in Kubernetes, using the image available in Kubernetes nodes, and notify once the intended service starts running on the pod.
__Please note that each Kubernetes node needs the [`mysql:5.5`](https://hub.docker.com/_/mysql/) Docker image in the node's Docker registry.__
- Add an host entry (in Linux, using the
/etc/hosts
file) forwso2esb-default
, resolving to the Kubernetes node IP. - Access the Carbon Management Console URL using
https://wso2esb-default:32122/carbon/
- Navigate to
wso2esb
directory in Kubernetes repository;KUBERNETES_HOME/wso2esb
location. - run the
undeploy.sh
script:
**`./undeploy.sh`**
This will undeploy the WSO2 Enterprise Service Bus specific DB pod (`mysql-mbdb`), Kubernetes Replication Controllers, and Kubernetes services. Additionally if `-f` flag is provided when running `undeploy.sh`, it will also undeploy the shared Governance and User DB pods, Replication Controllers, and Services.
**`./undeploy.sh -f`**
For more detailed instructions on deploying WSO2 Enterprise Service Bus on Kubernetes, please refer the wiki links under the Documentation section below.