Author: Umesh Jajoo
Pre-requisites
- AWS account
- Anypoint Platform Credentials
- AWS CLI
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
- eksctl
https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html
- Kubectl
https://kubernetes.io/docs/tasks/tools/
- rtfctl
https://docs.mulesoft.com/runtime-fabric/1.5/install-rtfctl
Steps
- Configure your aws CLI using command:
AWS configure
You can get the access key and secret key from AWS console under “Your Security Credentials” tab:
- Now use the following eksctl command in your command prompt to create clusters in EKS. Use the command after tailoring it to your name, region, node.
eksctl create cluster \
–name={yourname}-eks \
–version=1.18 \
–region=us-east-2 \
–nodegroup-name=standard-workers \
–node-type=m4.large \
–nodes=2 \
–nodes-min=1 \
–nodes-max=4 \
- After Creating the clusters it will reflect in the AWS EKS console.
- Now use the following command to create kubeconfig for your cluster.
aws eks –region {region} update-kubeconfig –name {cluster_name}
- Now use the following command to check the status of the nodes. If it shows as ready, you are good to go ahead.
kubectl get nodes
- Using the Anypoint platform, create a Runtime Fabric in the runtime manager.
- After the Runtime Fabric is created we will get a Activation Code:
- Now using the following command in command prompt and replacing the {activation code} with the activation code from the anypoint platform, validate the RTF.
rtfctl validate {activation_code}
- Now using the below command install the rtf.(Replace the {activation code} with the activation code from anypoint platform).
rtfctl install {activation_code}
Once the installation is complete the Rtf should be in active state.
Next go to the associated environments and select and apply the environment.
- Now we need to encode the mule license key. This can be done using a Linux system or Mac Os. In the case of windows we can use Cygwin. Use the below command to encode the license key.
base64 -w0 license.lic
- Now use the license key generated from the above command and replace it in place of BASE64_ENCODED_LICENSE and run the below command to apply the license key.
rtfctl apply mule-license {BASE64_ENCODED_LICENSE}
- Verify if the licence key is applied using the below command.
rtfctl get mule-license
- In case you have a domain , you can apply the ingress template using the following command:
Kubectl apply -f /path/to/ingress-template.yaml
Sample ingress-template.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/service-upstream: “true”
nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite ^/app-name(/|$)(.*) /$2 break;
name: rtf-ingress-template
namespace: rtf
spec:
ingressClassName: rtf-nginx
rules:
– host: rtf.example.com
http:
paths:
– path: /app-name
pathType: ImplementationSpecific
backend:
service:
name: service
port:
number: 80
- Now you can start deploying your applications in the Runtime manager using jar files and selecting the target as the RTF created by you.
- Below is a scheduler based application (hellometroalk) that is deployed on the RTF. The scheduler based application has a request component which calls another cloudhub api (helloalk09). Which increases the input request count of the requested api as reflected in the diagram shown below.