Search code examples
azureazure-aksazure-container-registry

Testing a Deployed container in Kubernetes via python


I have pushed a container to Container registry and am able to deploy it to kubernetes. Whats the best way to run this container to test if the deployment is working fine? I have gone through the documentation and have seen that I can setup a endpoint but I am unable to figure out how to call the container once I have setup a post request to the endpoint. Note the container hosts a python script that basically runs a ml model and spits out a prediction. So I would like a way to do api calls to the cluster to run the container and a call to print the results of the container. Or instead of setting a endpoint are there better ways to accomplish this?


Solution

  • • Setting an endpoint to the Kubernetes pod for accessing the container and executing the python script in the container is a good approach.

    • As suggested in the Microsoft documentation, there are three options through which we can deploy API management in front of AKS. You can see the same in the picture provided in the document.

    https://learn.microsoft.com/en-us/azure/api-management/api-management-kubernetes#kubernetes-services-and-apis

    • Once you configure the API with Kubernetes cluster, you can deploy a model to Azure Kubernetes Service cluster, for that, you need to create a deployment configuration that describes the compute resources needed. For example, the number of cores and memory. You also need an inference configuration, which describes the environment needed to host the model and web service. For more information on creating the inference configuration, see how and where to deploy models.

    For more information on how you can deploy and reference a python ML model, you can refer to this document below: -

    https://learn.microsoft.com/en-us/azure/machine-learning/how-to-deploy-and-where?tabs=azcli