Unable to access my loadbalncer
Hi Team,
I am using AKS cluster to run my python application which is running on 5000 port. i just run that pod using below command.
kubectl run python-app --replicas=1 --labels="run=python-app" --image=rajadevops/python --port=5000
After my pod started, i created service using below command,
kubectl expose rs python-app-d96f4bbc8 --type="LoadBalancer" --name="python-service"
C:\Users\Raja>kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.0.1
I can see the public ip and the port, but i am unable to run application using this ip:port
when i hit <x.x.x.x>:30787 i got below response, can someone suggest how to fix this issue.
This site can’t be reached <x.x.x.x> took too long to respond. Search Google for 235 176 30787 ERR_CONNECTION_TIMED_OUT
Regards, Raja
Now I am able to access my loadbalncer on port 5000, I am trying to use port forwards using yaml file, but it is not working..
My Deployment yaml:
apiVersion: apps/v1beta1 kind: Deployment metadata: name: python-flask namespace: ge-dashboard-dev labels: app: python-flask spec: replicas: 1 selector: matchLabels: app: python template: metadata: labels: app: python spec: containers: - name: python image: rajadevops/python-flask ports: - name: python-port containerPort: 5000 livenessProbe: httpGet: path: / port: 5000 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 30
My Service yaml:
apiVersion: v1 kind: Service metadata: name: pythonservice namespace: ge-dashboard-dev labels: name: python spec: ports:
- port: 80 name: http targetPort: 5000 selector: app: python-flask type: LoadBalancer
Kindly suggest what mistake i did here..
Hello @rrajadevops, here is a simple example on AKS that I think does what you need: it sets up a pod that's listening on port 5000 and a load balancer that directs traffic on 8080 to it. Could you please let me know what error you are seeing so I can try and reproduce it?
Run this to create a Python HTTP server on 5000
kubectl run testserver --image=python:3.6 --port=5000 --command -- python -m http.server 5000
Run this to expose this via a public endpoint on 8080:
kubectl expose deploy testserver --type=LoadBalancer --port=8080 --target-port=5000
Get the public IP address (I replaced my public endpoint with A.B.C.D)
kubectl get svc testserver --watch
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
testserver LoadBalancer 10.0.200.17 A.B.C.D 8080:31353/TCP 22m
The endpoint is available via http://A.B.C.D:8080:
curl -I A.B.C.D:8080
HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.6.4
Date: Thu, 22 Mar 2018 00:38:18 GMT
Content-type: text/html
Content-Length: 987
Last-Modified: Thu, 22 Mar 2018 00:08:34 GMT
Hope this helps.
@drdarshan thanks for the details, this issue can be closed, i can access now