I dockerized this https://github.com/dstar55/docker-hello-world-spring-boot example and deployed to my Azure kubernetes cluster and the image won't display in the internal or external IP. I can't seem to figure it out! It's driving me nuts. Any help or advise? Thanks!
It should just print hello world in the web browser.
I'm running Kubernetes in Windows 10. To access Kubernetes I'm running
az aks browse --resource-group docker-cluster --name final2
It then connects and I'm able to view the dashboard locally. When I click services to find the internal IP, when I type this in the browser I'm getting this error.
Yaml File -
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "spring-boot-example-3",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/deployments/spring-boot-example-3",
"uid": "5fd1ec75-1c6d-11ea-bd7c-a63f8eaf100e",
"resourceVersion": "11119",
"generation": 2,
"creationTimestamp": "2019-12-11T23:24:27Z",
"labels": {
"k8s-app": "spring-boot-example-3"
},
"annotations": {
"deployment.kubernetes.io/revision": "1"
}
},
"spec": {
"replicas": 3,
"selector": {
"matchLabels": {
"k8s-app": "spring-boot-example-3"
}
},
"template": {
"metadata": {
"name": "spring-boot-example-3",
"creationTimestamp": null,
"labels": {
"k8s-app": "spring-boot-example-3"
}
},
"spec": {
"containers": [
{
"name": "spring-boot-example-3",
"image": "bcook88/spring-boot4",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always",
"securityContext": {
"privileged": false
}
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"schedulerName": "default-scheduler"
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": "25%",
"maxSurge": "25%"
}
},
"revisionHistoryLimit": 10,
"progressDeadlineSeconds": 600
},
"status": {
"observedGeneration": 2,
"replicas": 3,
"updatedReplicas": 3,
"readyReplicas": 3,
"availableReplicas": 3,
"conditions": [
{
"type": "Progressing",
"status": "True",
"lastUpdateTime": "2019-12-11T23:24:31Z",
"lastTransitionTime": "2019-12-11T23:24:27Z",
"reason": "NewReplicaSetAvailable",
"message": "ReplicaSet \"spring-boot-example-3-66d65987d7\" has successfully progressed."
},
{
"type": "Available",
"status": "True",
"lastUpdateTime": "2019-12-11T23:29:11Z",
"lastTransitionTime": "2019-12-11T23:29:11Z",
"reason": "MinimumReplicasAvailable",
"message": "Deployment has minimum availability."
}
]
}
}
Serivce -
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "spring-boot-example-3",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/services/spring-boot-example-3",
"uid": "5fdaa8c1-1c6d-11ea-bd7c-a63f8eaf100e",
"resourceVersion": "23726",
"creationTimestamp": "2019-12-11T23:24:27Z",
"labels": {
"k8s-app": "spring-boot-example-3"
}
},
"spec": {
"ports": [
{
"name": "tcp-80-85-67vw4",
"protocol": "TCP",
"port": 80,
"targetPort": 85,
"nodePort": 30910
}
],
"selector": {
"k8s-app": "spring-boot-example-3"
},
"clusterIP": "10.0.91.29",
"type": "LoadBalancer",
"sessionAffinity": "None",
"externalTrafficPolicy": "Cluster"
},
"status": {
"loadBalancer": {
"ingress": [
{
"ip": "52.141.220.136"
}
]
}
}
}
The log shows that the application is running correctly and it does run correctly locally.
According to the screenshot that you provide, it seems you create the service with a NodePort type Load Balancer for your application. It means you cannot access your application outside the AKS cluster nodes(generally the nodes do not have public IP). And you need to change the port with 8080 instead of 80 like it shows in the Dockerfile.
The solution is that you need to recreate your service with the load balancer type, then it will give you an external IP which you can access outside the cluster through the browser.
And you can also take a look at Publishing the services(service types).