k8s配置多端⼝ingress
⼀、背景:公司k8s在阿⾥云内⽹,购买的阿⾥云的k8s服务,配置neo4j后,需要外⽹访问neo4j的7474端⼝,配置上ingress后,使⽤域名访问后,web界⾯还会从本地跳转到7687端⼝,然⽽在ingress中只有7474端⼝,所以访问web界⾯有问题
以下为neo4j的yaml⽂件
apiVersion: v1
kind: PersistentVolume
metadata:
name: oss-neo4j-pv-preonline
nodeselectorspec:
capacity:
storage: 5000Gi
accessModes:
- ReadWriteMany
storageClassName: oss
flexVolume:
driver: "alicloud/oss"
options:
bucket: "centimani-storage-pre-online"
url: "oss-cn-b***nal.aliyuncs"
akId: LTAIhO***PeNLq5
akSecret: I91vxO*****XNuTNM
otherOpts: "-o max_stat_cache_size=0 -o allow_other"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: oss-neo4j-pvc-preonline
spec:
storageClassName: oss
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5000Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: no4j-deploy-preonline
namespace: default
labels:
app: neo4j
spec:
replicas: 1
selector:
matchLabels:
app: neo4j
template:
metadata:
labels:
app: neo4j
spec:
nodeSelector:
nodeGroup: preonline
containers:
- name: neo4j
image: registry-beijing.aliyuncs/wa***m-bj-registry-common/neo4j:3.5.8
ports:
- name: bolt
containerPort: 7687
- name: http
containerPort: 7474
volumeMounts:
- name: neo4j-data-oss-pvc
mountPath: /data/neo4j
subPath: neo4j/data/neo4j
volumes:
- name: neo4j-data-oss-pvc
persistentVolumeClaim:
claimName: oss-neo4j-pvc-preonline
imagePullSecrets:
- name: registry-secret
---
apiVersion: v1
kind: Service
metadata:
name: neo4j-service-preonline
namespace: default
labels:
service: neo4j-service-preonline
spec:
clusterIP: None
ports:
- name: http
protocol: TCP
port: 7474
targetPort: 7474
-
name: bolt
protocol: TCP
port: 7687
targetPort: 7687
selector:
app: neo4j
type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: w***4j-ingress-preonline
namespace: default
spec:
rules:
- host: te*****om-bj
http:
paths:
- backend:
serviceName: neo4j-service-preonline
servicePort: 7474
path: /
View Code
⼆、经过查阅⽂档,做出了如下修改
1、kubectl edit service/nginx-ingress-lb -n kube-system
2、kubectl edit configmap/tcp-services -n kube-system
执⾏完以上两步即可
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论