kubectl describe node docker-for-desktop
这将获取Docker桌面版Windows的IP地址。
但是,当我们在浏览器上使用ip:nodeport
时,它无法工作。
nodeport
是我们在Kubernetes集群的服务文件中提到的端口号。
请在代码部分查找myservice.yaml
文件。
apiVersion: v1
kind: Service
metadata:
name: xxxx
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
mykey: webapp
release: "0-5"
ports:
- name: http
port: 80
nodePort: 30080
#this is port number greater than 30000, and it is port of the Node where this cluster is present.
type: NodePort
http://<dockerDesktopIdaddress>:<nodeport>
nodeport
是kubernetes集群中服务文件中的端口号。
始终出现错误。
localhost
上公开了所有内容,所以不应该有任何问题。 - Rafał Leszko