unable to access the service deployed on local k8s cluster created using docker desktop.
#nginxsvc
#service
apiVersion: v1
kind: Service
metadata:
name: nginxsvc
labels:
app: nginx-app
spec:
selector:
app: nginx-app
type: LoadBalancer
ports:
- port: 8080 #service port
targetPort: 8080 #container port
protocols: TCP
#Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx-app
spec:
replicas: 1
selector:
matchLabels:
app: nginx-app
template:
metadata:
labels:
app: nginx-app
spec:
containers:
- name: nginx-controller
image: nginx:latest
ports:
- containerPort: 8080
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 15m <none>
service/nginxsvc LoadBalancer 10.98.148.173 localhost 8080:32090/TCP 15m app=nginx-app
tried accessing using localhost:32090
Try on the localhost:8080
You have to use the nginxsvc , port
The one you used 32090 is node port with this you have to use the Node-IP:nodeport
to access.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.