我目前有问题暴露在openshift 4环境中运行的pod。尝试连接https://route...
导致503.
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: app-elastic-route
namespace: app-test
spec:
to:
kind: Service
name: app-elastic-svc
weight: 100
port:
targetPort: 9200-es
tls:
termination: edge
insecureEdgeTerminationPolicy: None
wildcardPolicy: None
kind: Service
apiVersion: v1
metadata:
name: app-elastic-svc
namespace: app-test
spec:
ports:
- name: 9200-es
protocol: TCP
port: 8080
targetPort: 9200
selector:
app: app-elastic
type: ClusterIP
sessionAffinity: None
kind: Deployment
apiVersion: apps/v1
metadata:
name: app-deploy
namespace: app-test
spec:
replicas: 1
selector:
matchLabels:
app: app-elastic
template:
metadata:
creationTimestamp: null
labels:
app: app-elastic
spec:
volumes:
- name: application-config
configMap:
name: app-config
items:
- key: application.properties
path: application.properties
defaultMode: 420
containers:
- resources:
limits:
cpu: 750m
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi
name: app-elastic
ports:
- containerPort: 9200
protocol: TCP
imagePullPolicy: IfNotPresent
volumeMounts:
- name: application-config
readOnly: true
mountPath: /config
terminationMessagePolicy: File
image: >-
elastic/elasticsearch:7.14.0
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: { }
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
我有一个完全相同的设置运行端口8080的春季启动应用程序,这工作得很好!
我肯定豆荚是活的,当连接到豆荚本身curl localhost:9200
工作良好!
有人可以提供一些指针可能是错的,或者我如何能更详细地调查这个问题?!
在您的Route
中,port.targetPort
应该是8080
https→路线:443→服务:8080→豆荚:9200
在您的服务中,更改spec.ports[0]。端口到9200而不是8080,它应该工作。
显然我的服务和路由配置是正确的。事实上,吊舱在港口没有正常运行…
老实说,我不了解细节,但我不得不改变配置的pod与elasticsearch.yml
http.host: 0.0.0.0
http.port: 8080
transport.tcp.port: 9200
transport.host: localhost
下面的链接帮助了我:
可以't访问端口9200远程
https://github.com/elastic/elasticsearch/issues/19987