Microgateway 10.7 | webMethods Microgateway Help | Kubernetes Support | Kubernetes Sidecar Deployment | Deploying a Stand-alone Kubernetes Sidecar
 
Deploying a Stand-alone Kubernetes Sidecar
This section describes how you can deploy a stand-alone Kubernetes sidecar. Stand-alone means that the Microgateways are not connected to an API Gateway. The API definitions are provided through API Gateway export archives.
Before you start with the deployment ensure you have done the following:
*Ensure you have a running Kubernetes environment.
For details on setting up of a Kubernetes environment, see Kubernetes documentation.
*The native service Docker images are pushed to a Docker registry to make them available for the Kubernetes environment.
*To set up a Kubernetes sidecar deployment
1. Prepare the Microgateway Docker file.
You first create an archive with the prepared API from an API Gateway that holds the API definition for EmployeeService and then create a Docker file that runs Microgateway with that asset archive.
./microgateway.sh createAssetArchive -gw localhost:5555
-gwu user –gwp password –apis EmployeeService –a EmployeeService.zip

./microgateway.sh createDockerFile --http_port 7076
--docker_file DockerFileEmployees
--docker_dir . --archive EmployeeService.zip
2. Build the Microgateway Docker image and push it to the Docker registry.
This is achieved by tagging it with the registry URL.
docker build -t mg-employees-sidecar -f DockerFileEmployees .

docker tag mg-employees-sidecar reghost:regport/mg-employees-sidecar

docker push reghost:regport/mg-employees-sidecar
3. Create a template for Kubernetes sidecar deployment.
Microgateway offers a function to generate a Kubernetes YAML file, which can be used for a convenient deployment. You may specify the sidecar parameters together with the Microgateway image parameters to have the two containers created within one pod. There are additional options for number of pods or adjusting health checks.
./microgateway.sh createKubernetesFile
--docker_image reghost:regport/mg-employees-sidecar
--pod_name mg-employees-sidecar
--sidecar_docker_image reghost:regport/employees-sservice
--sidecar_pod_name employees-sservice
--output mg-employees-sidecar-deployment.yml
4. Create and check the Kubernetes deployment.
kubectl create –f mg-employees-sidecar-deployment.yml

kubectl get pods
NAME READY STATUS ...
mg-employees-sidecar 2/2 Running
The Kubernetes pod with the 2 containers are created and started. If the deployment is successful you should see 2 out of 2 containers running. You can now expose Microgateway sidecar deployment as a Kubernetes service.
kubectl expose deployment mg-employees-sidecar --type=NodePort --port=7076
5. Verify the Microgateway Kubernetes service definition including the exposed IP and port.
Get the Kubernetes services and find out the IP of the running Microgateway sidecar service:
kubectl get services

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) …
mg-employees-sidecar NodePort 10.99.106.44 <none> 7076:31238/TCP
You can now access the Microgateway server.
GET http://10.99.106.44:31238/rest/microgateway/status