How to Run WSO2 API Manager with MicroK8s on MacOS



MicroK8s is a local deployment of Kubernetes. In this post im going to explain how to run MicroK8s in MacOS and run WSO2 API Manager within that. Easiest way to get an Ubuntu VM on MacOS is with multipass.Goto  to the releases page and grab the latest package. Installing it is as simple as double-clicking on the .pkg file.

Then execute following commands to create microk8s VM in you machine.

multipass launch --name microk8s-vm --mem 4G --disk 40G
multipass exec microk8s-vm -- sudo snap install microk8s --classic
multipass exec microk8s-vm -- sudo iptables -P FORWARD ACCEPT

Then from this point onward you can start and stop instance as required.

multipass start microk8s-vm
multipass stop microk8s-vm

You can login to created instance with below command.

multipass shell microk8s-vm

Then to check running VM detains enter following command.
 >>multipass list
Name                    State             IPv4             Image
microk8s-vm             Running           192.168.64.2     Ubuntu 18.04 LTS


If you want to do complete cleanup then you may execute following command to do that.multipass

delete microk8s-vm
multipass purge

Then execute following command
 >>multipass exec microk8s-vm -- sudo /snap/bin/microk8s.status
microk8s is running
addons:
cilium: disabled
dashboard: disabled
dns: disabled
fluentd: disabled
gpu: disabled
helm: disabled
ingress: disabled
istio: disabled
jaeger: disabled
juju: disabled
knative: disabled
kubeflow: disabled
linkerd: disabled
metallb: disabled
metrics-server: disabled
prometheus: disabled
rbac: disabled
registry: disabled
storage: disabled

To start microk8s run following command on VM you created
>>sudo microk8s.start

Now we can login to VM created and install kubectl there. To install kubectl on VM you can follow this article(https://kubernetes.io/docs/tasks/tools/install-kubectl/) too.

To check installation happened successfully enter following command.
>>sudo microk8s.kubectl version

Now we need to copy API Manager artifacts to VM from host machine. To do that we can use following command.
>>multipass copy-files ~/Downloads/api-k8s-crds-1.0.1.zip microk8s-vm:

Now login to VM and unzip copied file. Then go to api-k8s-crds-1.0.1 directory and

>>sudo microk8s.kubectl apply -f k8s-artifacts/api-portal
namespace/wso2 created
configmap/apim-conf created
deployment.apps/wso2apim created
service/wso2apim created

You can check the status of started server with following command.
>>sudo microk8s.kubectl get pods -n wso2
NAME                        READY   STATUS    RESTARTS   AGE
wso2apim-54f8f59546-qlwgm   1/1     Running   0          8m16s

Now our server is up and running in microk8s deployed in ubuntu VM. Now we can access that from host machine. First we need to add /etc/hosts entry to map host name. Please check VM instance IP address and add etc host entry mapping to that.
From host machine when you enter following command it will give host machines IP.
multipass list
Name                    State             IPv4             Image
microk8s-vm             Running           192.168.64.2     Ubuntu 18.04 LTS

Now we need to add /etc/hosts entry to map host name as follows.
192.168.64.2    wso2apim

Now you can enter URL in browser and access API developer portal.
>>https://wso2apim:32001/devportal/


No comments:

Post a Comment

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...