我正在本地运行 Kubernetes 集群,使用 KubeAdm 进行初始化。 我配置了 flannel 网络插件。
当我将服务公开为 NodePort 时,我无法接收外部 IP。 我错过了什么?
我的 deployment yaml 文件如下:
apiVersion: v1
kind: Service
metadata:
name: testapp
labels:
run: testapp
spec:
type: NodePort
ports:
- port: 8080
targetPort: 80
protocol: TCP
name: http
- port: 443
protocol: TCP
name: https
selector:
run: testapp
---------
apiVersion: apps/v1
kind: Deployment
metadata:
name: testapp
spec:
selector:
matchLabels:
run: testapp
replicas: 2
template:
metadata:
name: testapp
labels:
run: testapp
spec:
containers:
- image: [omitted]
name: testapp
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /api/health
port: 80
环境详细信息:
Kubernetes 版本:
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"d2835416544f298c919e2ead3be3d0864b52323b", GitTreeState:"clean", BuildDate:"2018-02-07T12:22:21Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"d2835416544f298c919e2ead3be3d0864b52323b", GitTreeState:"clean", BuildDate:"2018-02-07T11:55:20Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
在本地运行的 vSphere 虚拟机上安装了 Ubuntu Server 16.04。