Kubernetes - Unable to access apache Pod from proxy
The problem is that Apache is listening on port 80, not 5000.
If you remove containerPort: 5000
then you can access the website via http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/
.
Secondly, the endpoints you see for the service are internal to the cluster.So, you can access the service through those IP endpoints from within a pod: kubectl exec website -- curl 172.17.0.6/
.If you want to expose your service externally, the service should be of type NodePort
or LoadBalancer
.
Finally, the problem you have when querying the service through the proxy is that, when you give a name to a port, you have to include it in the proxy call: curl localhost:8001/api/v1/namespaces/default/services/website-service:serving/proxy/
.