Kubernetes Pod(Plex)上的连接被拒绝

时间:2020-01-24 06:51:33

标签: kubernetes plex

在裸机三节点本地群集上设置Kubernetes。

Plex部署:

kind: Deployment
apiVersion: apps/v1
metadata:
  name: plex
  labels:
    app: plex
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      name: plex
  template:
    metadata:
      labels:
        name: plex
    spec:
      containers:
        - name: plex
          image: plexinc/pms-docker:plexpass
          imagePullPolicy: Always
          ports:
            - containerPort: 32400
              hostPort: 32400
          volumeMounts:
            - name: nfs-plex-meta
              mountPath: "/data"
            - name: nfs-plex
              mountPath: "/config"
      volumes:
      - name: nfs-plex-meta
        persistentVolumeClaim:
          claimName: nfs-plex-meta
      - name: nfs-plex
        persistentVolumeClaim:
          claimName: nfs-plex

部署很高兴。豆荚很开心。

我尝试通过NodePort,ClusterIP,HostPort,LoadBallancer(metalDB)公开Pod,并且在每个排列中,我都在浏览器或Curl中遇到连接被拒绝的错误。

NodePort示例:

$ kubectl expose deployment plex --type=NodePort --name=plex
service/plex exposed
$ kubectl describe svc plex
Name:                     plex
Namespace:                default
Labels:                   app=plex
Annotations:              <none>
Selector:                 name=plex
Type:                     NodePort
IP:                       10.111.13.7
Port:                     <unset>  32400/TCP
TargetPort:               32400/TCP
NodePort:                 <unset>  30275/TCP
Endpoints:                10.38.0.0:32400
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
$ curl 10.111.13.7:32400
curl: (7) Failed to connect to 10.111.13.7 port 32400: Connection refused
$ curl 10.38.0.0:32400
curl: (7) Failed to connect to 10.38.0.0 port 32400: Connection refused
$ curl 192.168.1.11:32400
curl: (7) Failed to connect to 192.168.1.110 port 32400: Connection refused
$ curl 192.168.1.11:30275
curl: (7) Failed to connect to 192.168.1.110 port 30275: Connection refused

我在这里想念什么?

1 个答案:

答案 0 :(得分:0)

因此,只有最后一个可能是正确的。该输出中的IP是群集IP,通常(尽管并非总是如此,取决于您的CNI插件和配置)只能从其他Pod在群集内部访问。 NodePort意味着该服务也可以在任何节点IP上的该端口上访问。但是,这可能会被您节点上的防火墙阻止,因此请检查一下。还要确保这是一个有效的节点IP。

相关问题