k8s Service配置多个端口
ServiceapiVersion: v1kind: Servicemetadata:name: xxxnamespace: openspec:type: NodePortports:- name: tcpport: 8888targetPort: 8888nodePort: 8888protocol: TCP- name: httpport: 8080targetPort: 8080nodeP
·
Service
apiVersion: v1
kind: Service
metadata:
name: xxx
namespace: open
spec:
type: NodePort
ports:
- name: tcp
port: 8888
targetPort: 8888
nodePort: 8888
protocol: TCP
- name: http
port: 8080
targetPort: 8080
nodePort: 8080
protocol: TCP
selector:
name: xxx
Ingress
注意:只配置了tcp的端口
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: xxx-ingress
namespace: open
spec:
rules:
- host: xxx.coding.net
http:
paths:
- path: /
backend:
serviceName: xxx
servicePort: 8888
更多推荐
已为社区贡献6条内容
所有评论(0)