我遇到了一个奇怪的问题,其中一个环境中的Pod不允许通过指定的端口进行请求
从另一个吊舱:
/app # wget 10.12.2.22:6000
Connecting to 10.12.2.22:6000 (10.12.2.22:6000)
wget: error getting response`
通过服务:
/app # wget services:6000
Connecting to services:6000 (10.15.249.82:6000)
wget: error getting response: Resource temporarily unavailable
从内部开始:
/app # wget localhost:6000
converted 'http://localhost:6000' (ANSI_X3.4-1968) -> 'http://localhost:6000' (UTF-8)
--2018-10-03 01:26:39-- http://localhost:6000/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:6000... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-10-03 01:26:39 ERROR 404: Not Found.
这是我的YAML:
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: services
namespace: production
labels:
name: services
spec:
replicas: 1
selector:
matchLabels:
app: services
version: production
template:
metadata:
name: services
labels:
app: services
version: production
spec:
containers:
- name: services
image: gcr.io/myproject/services:v1.6.0
imagePullPolicy: Always
volumeMounts:
- name: "gc-serviceaccount"
readOnly: true
mountPath: "/app/secrets"
securityContext:
privileged: true
ports:
- name: http
containerPort: 3000
protocol: TCP
- name: sockets
containerPort: 6000
protocol: TCP
env:
- name: NODE_ENV
value: "local"
- name: PORTAL_HOST
value: "portal.myproject.com"
- name: PORTAL_HOSTNAME
value: "http://portal"
- name: DESIGNER_HOSTNAME
value: "http://designer"
- name: FILE_HOST
value: "https://files.myproject.com"
- name: STORAGE_BUCKET
value: "production"
- name: DATA_PATH
value: ""
- name: MONGO_DB_NAME
value: "MyProject"
- name: MONGO_REPLICA_SET
value: "myproject"
- name: PORT
value: "3000"
- name: REDIS_HOSTNAME
value: "redis"
- name: REDIS_PORT
value: "6379"
- name: SOCKETCLUSTER_WS_ENGINE
value: "ws"
- name: SOCKETCLUSTER_PORT
value: "6000"
- name: CLIENT_HOST
value: "myproject.com"
readinessProbe:
httpGet:
path: /healthz
port: 3000
periodSeconds: 1
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 10
volumes:
- name: "gc-serviceaccount"
secret:
secretName: "gc-serviceaccount"
---
apiVersion: v1
kind: Service
metadata:
name: services
namespace: production
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: http
- name: sockets
port: 6000
targetPort: sockets
selector:
app: services
值得注意的是,当尝试从端口3000上的另一个Pod连接到Pod时,我没有任何问题。
到目前为止,我已经创建了一个新环境并部署到该环境,但是我收到了相同的错误。
奇怪的是,我的其他较旧的环境运行良好,所以我想知道这是否是Kubernetes的问题?