I have a java17-osgi-application running inside a docker Container. On a local Windows host with podman the application runs and is reachable. I perform a netstat -tane on the shell and this is the output.
The first netstat -tane is before and the second is after I visit the application via brower.
In Kubernetes (aks on azure) I use a deployment with one pod. The Image is the same but I can not reach the application via browser. The output of netstat -tane is:
The first netstat -tane is bevore and the second is after I access the application via browser.
It seems like in the pod did not bind the IP Adress. Is there a way to solve this without touching the java17-osagi-app?


To expose your java17-osgi-application running on Azure Kubernetes Service, as I mentioned in the comment section, you can create a Service with type Load Balancer. In the Service manifest, you can specify the port number and target port for your application. Here is an example manifest:
After you deploy the manifest, you can confirm that the Service is created, and the Load Balancer is configured using the following command:
When you view the service details, the public IP address created for this service on the load balancer is shown in the EXTERNAL-IP column. It might take a few minutes for the IP address to change from
<pending>to an actual public IP address.Let me take a flask app example that says This is a Hello World application using the below code.
Then containerize the app using docker and then build it using
docker build -t bravinwasike/flask-kubernetes .Output:
after that push the Docker image into my Azure container repository using the following commands:
then I deployed the containerized application to the created AKS cluster
Followed by creating a deployment and service (Load Balancer) yaml file that refers to the image that I just pushed in my acr
Deployment and service yaml file combined
then apply the yaml
Done.. Now when I do
kubectl get podsmy pods are upand my flask app is up and reachable via the load balancer.
Alternatively, you can use Ingress to expose your application as well. To use Ingress, you need to deploy an Ingress controller in your cluster. Here is an example Ingress manifest:
In this example, the Ingress controller listens on port 80 for requests to the host
my-website.com. Requests to the root path/are forwarded to themy-websiteservice on port 80. Thenginx.ingress.kubernetes.io/rewrite-targetannotation rewrites the URL path to remove the/prefix. You can deploy this manifest usingkubectl apply -f <filename>.References: