k8s Service配置多个端口

迈不过友情╰ 2022-12-31 01:28 348阅读 0赞

Service

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: xxx
  5. namespace: open
  6. spec:
  7. type: NodePort
  8. ports:
  9. - name: tcp
  10. port: 8888
  11. targetPort: 8888
  12. nodePort: 8888
  13. protocol: TCP
  14. - name: http
  15. port: 8080
  16. targetPort: 8080
  17. nodePort: 8080
  18. protocol: TCP
  19. selector:
  20. name: xxx

Ingress

注意:只配置了tcp的端口

  1. apiVersion: extensions/v1beta1
  2. kind: Ingress
  3. metadata:
  4. name: xxx-ingress
  5. namespace: open
  6. spec:
  7. rules:
  8. - host: xxx.coding.net
  9. http:
  10. paths:
  11. - path: /
  12. backend:
  13. serviceName: xxx
  14. servicePort: 8888

发表评论

表情:
评论列表 (有 0 条评论,348人围观)

还没有评论,来说两句吧...

相关阅读

    相关 K8SService

    一、K8S中service存在的意义 1.解决节点失联问题 我们知道,pod是k8s中最小的运行单元,每次运行的时候,ip都是临时短暂的,下次重启,ip是会变的,s

    相关 k8s - SVC(Service)

    Service `SVC`用来做服务发现 k8s定义了这样一组抽象:一个`Pod`的逻辑分组,一种可以访问它们的策略 - 通常称为微服务。这一组`Pod`能够被`Ser