I have the following deployment file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deploy
spec:
replicas: 10
selector:
matchLabels:
app: hello-world
revisionHistoryLimit: 5
progressDeadlineSeconds: 300
minReadySeconds: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-pod
image: nginx
ports:
- containerPort: 8080
resources:
limits:
memory: 128Mi
cpu: 0.1
I check and all the pods are running:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-deploy-7c547fdb4-2tpnc 1/1 Running 0 18m
hello-deploy-7c547fdb4-4kjtt 1/1 Running 0 18m
hello-deploy-7c547fdb4-6cvmt 1/1 Running 0 18m
hello-deploy-7c547fdb4-9gvj6 1/1 Running 0 18m
hello-deploy-7c547fdb4-ctjxx 1/1 Running 0 18m
hello-deploy-7c547fdb4-ggl6n 1/1 Running 0 18m
hello-deploy-7c547fdb4-m528n 1/1 Running 0 18m
hello-deploy-7c547fdb4-mg9gf 1/1 Running 0 18m
hello-deploy-7c547fdb4-t9srq 1/1 Running 0 18m
hello-deploy-7c547fdb4-zcjkt 1/1 Running 0 18m
I also have the following service defined:
apiVersion: v1
kind: Service
metadata:
name: lb-svc
labels:
app: hello-world
spec:
type: LoadBalancer
ports:
- port: 8080
protocol: TCP
selector:
app: hello-world
I check and it is also running:
$ kubect get svc lb-svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
lb-svc LoadBalancer 10.100.237.251 localhost 8080:31527/TCP 10m
But when I do in my chrome browser http://localhost:8080
I get This page isn't working ERR_EMPTY_RESPONSE
Kubernetes version
$ kubectl version
Client Version: v1.32.1
Kustomize Version: v5.5.0
Server Version: v1.30.5
WARNING: version difference between client (1.32) and server (1.30) exceeds the supported minor version skew of +/-1
What am I doing wrong?
I have the following deployment file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deploy
spec:
replicas: 10
selector:
matchLabels:
app: hello-world
revisionHistoryLimit: 5
progressDeadlineSeconds: 300
minReadySeconds: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-pod
image: nginx
ports:
- containerPort: 8080
resources:
limits:
memory: 128Mi
cpu: 0.1
I check and all the pods are running:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-deploy-7c547fdb4-2tpnc 1/1 Running 0 18m
hello-deploy-7c547fdb4-4kjtt 1/1 Running 0 18m
hello-deploy-7c547fdb4-6cvmt 1/1 Running 0 18m
hello-deploy-7c547fdb4-9gvj6 1/1 Running 0 18m
hello-deploy-7c547fdb4-ctjxx 1/1 Running 0 18m
hello-deploy-7c547fdb4-ggl6n 1/1 Running 0 18m
hello-deploy-7c547fdb4-m528n 1/1 Running 0 18m
hello-deploy-7c547fdb4-mg9gf 1/1 Running 0 18m
hello-deploy-7c547fdb4-t9srq 1/1 Running 0 18m
hello-deploy-7c547fdb4-zcjkt 1/1 Running 0 18m
I also have the following service defined:
apiVersion: v1
kind: Service
metadata:
name: lb-svc
labels:
app: hello-world
spec:
type: LoadBalancer
ports:
- port: 8080
protocol: TCP
selector:
app: hello-world
I check and it is also running:
$ kubect get svc lb-svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
lb-svc LoadBalancer 10.100.237.251 localhost 8080:31527/TCP 10m
But when I do in my chrome browser http://localhost:8080
I get This page isn't working ERR_EMPTY_RESPONSE
Kubernetes version
$ kubectl version
Client Version: v1.32.1
Kustomize Version: v5.5.0
Server Version: v1.30.5
WARNING: version difference between client (1.32) and server (1.30) exceeds the supported minor version skew of +/-1
What am I doing wrong?
Share Improve this question edited Feb 2 at 10:44 Jim asked Feb 1 at 19:38 JimJim 4,4254 gold badges30 silver badges60 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0by default nginx image is running on port 80
not 8080
localhost
is a very context-sensitive name; if you're typing it into your browser, it refers to the machine the browser is running on, not any of the Kubernetes Pods or the Nodes they're running on, each of which separately believes they arelocalhost
. What sort of Kubernetes installation and load balancer provider are you using? – David Maze Commented Feb 1 at 19:59localhost
because that is what is mentioned in theEXTERNAL-IP
of thekybectl get svc
. Since I am usingDocker Engine
with Kubernetes enabled. How do I check what load balancer provider am I using? I am on Kubuntu btw – Jim Commented Feb 1 at 20:3180
not8080
– shadowlegend Commented Feb 2 at 16:36