[英]how to deploy and access loadbalancer kubernetes service on localhost/local machine using docker desktop k8s cluster?
unable to access the service deployed on local k8s cluster created using docker desktop.无法访问部署在使用 docker 桌面创建的本地 k8s 集群上的服务。
#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
尝试使用
localhost:32090
访问
Try on the localhost:8080
You have to use the nginxsvc , port尝试在
localhost:8080
你必须使用nginxsvc端口
The one you used 32090 is node port with this you have to use the Node-IP:nodeport
to access.您使用的32090是节点端口,您必须使用
Node-IP:nodeport
才能访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.