OLM Deployment of Operator
The other method to run the APIMatic Operator is through the OLM Deployment. OLM is a component of the Operator Framework, an open source toolkit to manage Kubernetes native applications called Operators in an effective, automated, and scalable way.
To utilize Operator LifeCycle Manager (OLM) to deploy the APIMatic operator, follow the detailed steps given below.
- Clone the APIMatic repository into your working directory using the
git clonecommand.
git clone https://github.com/apimatic/apimatic-kubernetes-operator.git
Run the following script to install the resources required by OLM to deploy the APIMatic operator in the Kubernetes cluster within the
apimatic-systemnamespace. Information about the different resources required can be found using the steps given in the Operator Framework Docs.
kubectl apply -f olm/manifests.yaml
- This should spin up the
ClusterServiceVersionof the operator in theapimatic-systemnamespace, following which the operator pod will spin up. To ensure that the operator installed successfully, check for theClusterServiceVersionand the operator deployment in the namespace it was installed in usingkubectl getcommand.
kubectl get csv -n apimatic-system
kubectl get deployment -n apimatic-system
- Create a secret named
apimaticimagesecretusing thekubectl create secretcommand to allow pulling the APIMatic CodeGen image using the Docker Hub username registered with APIMatic. If you have not done so, please contactsupport@apimatic.iofor the steps required.
kubectl create secret docker-registry apimaticimagesecret --docker-server=https://index.docker.io/v1/ --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
- Create a configmap resource named
apimaticlicensethat will serve as the volume storing the APIMatic license. An example of this is given below which will create the ConfigMap using the License.lic file located at /user/local/apimatic/license/.
kubectl create configmap apimaticlicense --from-file /usr/local/apimatic/license/License.lic
- This will deploy a ConfigMap resource with the following definition:
apiVersion: v1
data:
License.lic: \"<License file contents here>\"
kind: ConfigMap
metadata:
name: apimaticlicense
namespace: default
- Now run the sample using the
kubectl applycommand.
kubectl apply -f config/samples/apicodegen_v1beta1_apimatic.yaml
You will now see a new Deployment with replica count of 3 and Service of type
NodePortcreated, both namedapimatic-sample. Accessinghttp://localhost:32000from your browser (or using curl from within the Minikube or Kind cluster, if using that) should now show the APIMatic Titan page.You can now use the exposed APIMatic CodeGen API to generate API SDKs and Docs using curl, Postman or your own custom Web application that consumes the APIMatic CodeGen API service.
Once done, you can remove the APIMatic operator resources using the
kubectl deletescript.
kubectl delete -f olm/manifests.yaml