首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接到无状态集的无头服务的端口问题

连接到无状态集的无头服务的端口问题
EN

Stack Overflow用户
提问于 2019-08-20 13:42:28
回答 1查看 519关注 0票数 1

嗨,我正在尝试公开一个Informix的5个端口,该容器位于一个statefulSet中。它附带了一个无头服务,允许其他内部无状态集在内部与其通信。

我可以将无头服务informix-set-service从我的informix-0吊舱和其他吊舱中打开,但是当我尝试nmap -p 9088 informix-set-service时,端口被列为已关闭的端口。我认为这是因为我的yaml是错的,但我不能一辈子找出哪里是错的。

似乎无头服务确实是附加和指向正确的有状态集和在迷你的仪表板内,一切看起来和似乎是正确的。

服务微型破折号截图

代码语言:javascript
复制
informix@informix-0:/$ nmap -p 9088 informix-set-service

Starting Nmap 6.47 ( http://nmap.org ) at 2019-08-20 03:50 UTC
Nmap scan report for informix-set-service (172.17.0.7)
Host is up (0.00011s latency).
rDNS record for 172.17.0.7: informix-0.informix.default.svc.cluster.local
PORT     STATE  SERVICE
9088/tcp closed unknown

Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds
informix@informix-0:/$ nmap -p 9088 localhost

Starting Nmap 6.47 ( http://nmap.org ) at 2019-08-20 03:50 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00026s latency).
Other addresses for localhost (not scanned): 127.0.0.1
PORT     STATE SERVICE
9088/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds

有人有什么想法吗?

部署yaml片段:

代码语言:javascript
复制
###############################################################################
# Informix Container
###############################################################################
#
# Headless service for Informix container StatefulSet.
# Headless service with clusterIP set to NULL
# create DNS records for Informix container hosts.
#
apiVersion: v1
kind: Service
metadata:
  name: informix-set-service
  labels:
    component: informix-set-service
    provider: IBM
spec:
  clusterIP: None
  ports:
  - port: 9088
    name: informix
  - port: 9089
    name: informix-dr
  - port: 27017
    name: mongo
  - port: 27018
    name: rest
  - port: 27883
    name: mqtt
  selector:
    component: informix-set-service
---
#
# Service for Informix container StatefulSet service.
# This is used as an external entry point for 
# the ingress controller.
#
apiVersion: v1
kind: Service
metadata:
  name: informix-service
  labels:
    component: informix-service
    provider: 4js
spec:
  ports:
  - port: 9088
    name: informix
  - port: 9089
    name: informix-dr
  - port: 27017
    name: mongo
  - port: 27018
    name: rest
  - port: 27883
    name: mqtt
  selector:
    component: informix-set-service
---
#
# StatefulSet for Informix cluster.
# StatefulSet sets predictible hostnames,and external storage is bound
# to the pods within StateFulSets for the life.
# Replica count configures number of Informix Server containers.
#
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: informix
  labels:
    app: informix
    component: db
    release: "12.10"
    provider: IBM
spec:
  serviceName: informix
  #replicas: 2 #keep it simple for now...
  selector:
    matchLabels:
      component: informix-set-service
  template:
    metadata:
      labels:
        component: informix-set-service
    spec:
      containers:
      - name: informix
        image: ibmcom/informix-innovator-c:12.10.FC12W1IE
        tty: true
        securityContext:
          privileged: true
        env:
        - name: LICENSE
          value: "accept"
        - name: DBDATE
          value: "DMY4"
        - name: SIZE
          value: "custom"
        - name: DB_USER
          value: "db_root" 
        - name: DB_NAME
          value: "db_main"
        - name: DB_PASS
          value: "db_pass123"
        ports:
        - containerPort: 9088
          name: informix
        - containerPort: 9089
          name: informix-dr
        - containerPort: 27017
          name: mongo
        - containerPort: 27018
          name: rest
        - containerPort: 27883
          name: mqtt
        volumeMounts:
        - name: data
          mountPath: /opt/ibm/data
        - name: bind-dir-mnt
          mountPath: /mnt
        - name: bind-patch-informix-setup-sqlhosts
          mountPath: /opt/ibm/scripts/informix_setup_sqlhosts.sh
        - name: bind-file-dbexport
          mountPath: /opt/ibm/informix/bin/dbexport
        - name: bind-file-dbimport
          mountPath: /opt/ibm/informix/bin/dbimport
        - name: bind-file-ontape
          mountPath: /opt/ibm/informix/bin/ontape
        - name: bind-file-informix-config
          mountPath: /opt/ibm/data/informix_config.custom
        - name: bind-file-sqlhosts
          mountPath: /opt/ibm/data/sqlhosts
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: ifx-data
      - name: bind-dir-mnt
        hostPath:
          path: <PROJECTDIR>/resources/informix
          type: DirectoryOrCreate
      - name: bind-patch-informix-setup-sqlhosts
        hostPath:
          path: <PROJECTDIR>/containers/informix/resources/scripts/informix_setup_sqlhosts.sh
          type: File
      - name: bind-file-dbexport
        hostPath:
          path: <PROJECTDIR>/containers/informix/resources/bin/dbexport
          type: File
      - name: bind-file-dbimport
        hostPath:
          path: <PROJECTDIR>/containers/informix/resources/bin/dbimport
          type: File
      - name: bind-file-ontape
        hostPath:
          path: <PROJECTDIR>/containers/informix/resources/bin/ontape
          type: File
      - name: bind-file-informix-config
        hostPath:
          path: <PROJECTDIR>/containers/informix/resources/informix_config.custom
          type: File
      - name: bind-file-sqlhosts
        hostPath:
          path: <PROJECTDIR>/containers/informix/resources/sqlhosts.k8s
          type: File
---

编辑1:(增加ss -lnt的输出)

代码语言:javascript
复制
informix@informix-0:/$ ss -lnt
State       Recv-Q Send-Q              Local Address:Port                Peer Address:Port
LISTEN      0      0                       127.0.0.1:9088                           *:*
LISTEN      0      0                       127.0.0.1:9089                           *:*
LISTEN      0      0                      172.17.0.7:27017                          *:*
LISTEN      0      0                      172.17.0.7:27018                          *:*
LISTEN      0      0                      172.17.0.7:27883                          *:*
LISTEN      0      0                               *:22                             *:*
LISTEN      0      0                              :::22                            :::*
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-08-20 16:44:34

ss输出中,您正在监听127.0.0.1,而不是所有接口:

代码语言:javascript
复制
informix@informix-0:/$ ss -lnt
State       Recv-Q Send-Q              Local Address:Port                Peer Address:Port
LISTEN      0      0                       127.0.0.1:9088                           *:*
LISTEN      0      0                       127.0.0.1:9089                           *:*

您需要调整您的应用程序配置,以侦听类似于0.0.0.0的内容,以便能够从pod之外访问它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57575059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档