Microgateway 10.7 | webMethods Microgateway Help | Kubernetes Support | Deploying Microgateway as a Kubernetes Service
 
Deploying Microgateway as a Kubernetes Service
Microgateway can run as a separate Kubernetes service protecting other Kubernetes services. Microgateway as a Kubernetes service is running in a dedicated pod and protects one or more native services running within the Kubernetes environment. The set of services have to be static since Microgateway can only handle a static set of services.
This section explains how to deploy Microgateway as a Kubernetes service.
*To deploy a Microgateway as a Kubernetes service
1. Ensure you have a running Kubernetes environment.
For details on setting up of a Kubernetes environment, see Kubernetes documentation.
2. Create a Microgateway Docker image.
a. Create a Docker file with any configuration.
For example, prepare a Microgateway image running the EmployeeService:
./microgateway.sh createDockerFile --http_port 7071
--docker_file MyDockerFile --docker_dir . --archive EmployeeService.zip
b. Build the Microgateway Docker image and prepare it for pushing to a Docker registry to make it available for Kubernetes.
docker build -t mg-employees -f MyDockerFile .
docker tag my-microgw reghost:regport/mg-employees
c. Push the Docker image to the Docker registry.
docker push reghost:regport/mg-employees
The Microgateway Docker image is now ready and can be used from Kubernetes.
3. Create and expose Microgateway as Kubernetes deployment as follows:
kubectl create deployment mg-employees
--image=reghost:regport/my-employees
kubectl expose deployment mg-employees --type=NodePort --port=7071
A Kubernetes pod is created and started, after which a Kubernetes service is exposed through a port that can be accessed from outside the cluster.
4. Verify the Microgateway Kubernetes service definition and the exposed IP and port.
Get the Kubernetes services and find out the IP of the running Microgateway service:
kubectl get services

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) …
mg-employees NodePort 10.99.156.94 <none> 7071:31428/TCP
. . .
You should now be able to access Microgateway service as follows:
GET http://10.99.156.94:31428/rest/microgateway/status