当前位置: 首页 > article >正文

记录一下_treafik使用Gateway-APi使用的细节参数

一、这里说一下treafik最大的容易走入圈套的地方。

        1、treafik默认不是hostnetwork模式。为了暴露自己出来它有一个LB类型的SVC。

这里的External_ip为我的节点IP,因为使用了k3s自带的LB,这个SVC就很容易绕进去。

        1、第一个这个LB的作用是为了暴露treafik给集群外的Client访问使用。

        2、这里的80和443是占用了External_ip为我的节点IP的80和443.

        3、以及对应的30285和32299都是占用了节点IP的端口。

        4、相当于浪费了两个端口。

        5、正常如果是hostnetwork模式就没有这个问题。

二、gateway的配置。

*这里的端口8443对应是配置treafik中POD的监听端口:
    websecure:  # 用于 Gateway
      port: 8443
      protocol: TCP 

*这里的工作流是这样的:

        1、通过gatewayclass找到 traefik.

        2、通过label找到treafik

                                        3、然后把gateway配置文件丢给treafik进行处理。

ip-172-27-183-66:~/harbor/istio # cat harbor-gateway.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: harbor-gateway
  namespace: harbor
spec:
  gatewayClassName: traefik
  listeners:
  - name: https
    port: 8443
    protocol: HTTPS
    hostname: "k8s.kox xne"
    tls:
      mode: Terminate
      certificateRefs:
      - kind: Secret
        name: k8s.koxxxxxline
    allowedRoutes:
      namespaces:
        from: Same

三、helm参数

deployment:
  podAnnotations:
    prometheus.io/port: "8082"
    prometheus.io/scrape: "true"
global:
  systemDefaultRegistry: ""
image:
  repository: rancher/mirrored-library-traefik
  tag: 3.3.2
priorityClassName: system-cluster-critical
providers:
  kubernetesIngress:
    enable: false
    publishedService:
      enabled: true
    nativeLBByDefault: true
  kubernetesGateway: 
    enabled: true
    nativeLBByDefault: true #打开则通过svc再L B一次,默认false 直接到pod
gateway:
  enabled: true
  listeners:
    web:  # 用于 Gateway
      port: 8000
      protocol: TCP
    websecure:  # 用于 Gateway
      port: 8443
      protocol: TCP 

service:
  ipFamilyPolicy: PreferDualStack
tolerations:
- key: CriticalAddonsOnly
  operator: Exists
- effect: NoSchedule
  key: node-role.kubernetes.io/control-plane
  operator: Exists
- effect: NoSchedule
  key: node-role.kubernetes.io/master
  operator: Exists

四、重点istio

istio的gateway提供会自动生成一个lb的svc。这么做就相当于直接把服务暴露到外面,特别适合和公有云集成特别好的场景。一个业务自动一个LB。


http://www.kler.cn/a/557455.html

相关文章:

  • [ComfyUI]Recraft贴图开源方案,实现服装印花自由
  • P2865 [USACO06NOV] Roadblocks G 与最短路的路径可重复的严格次短路
  • Spring Boot中整合Flink CDC 数据库变更监听器来实现对MySQL数据库
  • 工业级无人机手持地面站技术详解
  • 基于SpringBoot+vue+uniapp的智慧旅游小程序+LW示例参考
  • DirectX SDK(June 2010)安装报错:S1023
  • 0222-leetcode-1768.交替合并字符串、389找不同、
  • 0基础学Linux系统(准备1)
  • Java试题:进制转换
  • SQL Server 创建用户并授权
  • 【部署优化篇十三】深度解析《DeepSeek API网关:Kong+Nginx配置指南》——从原理到实战的超详细手册
  • 3.3.2 交易体系构建——缠论操作思路
  • Git常见命令--助力开发
  • C++ 设计模式-中介者模式
  • Python采用DeepSeekR1本地部署+本地API接口实现简单对话
  • 基于传统信息检索算法 BM25 的检索器 和 基于大语言模型生成的文本嵌入(dense embeddings)来计算相似度的检索器 两者的区别和联系
  • docker搭建tars框架
  • Pytorch的F.cross_entropy交叉熵函数
  • 51单片机-串口通信编程
  • 创建监听器报错“一个或多个listeners启动失败”