记录一下_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。

相关推荐
飞火流星020272 天前
SkyWalking异步采集spring gateway日志
gateway·skywalking·日志监控·gateway链路监控
要开心吖ZSH2 天前
【Spring Cloud Gateway 实战系列】高级篇:服务网格集成、安全增强与全链路压测
spring cloud·微服务·gateway·istio
德育处主任Pro2 天前
解放生产力:Amazon API Gateway 与 Amazon Lambda 的优雅组合
gateway·aws·亚马逊
java叶新东老师2 天前
spring gateway 配置http和websocket路由转发规则
spring·http·gateway
java叶新东老师2 天前
五、搭建springCloudAlibaba2021.1版本分布式微服务-gateway网关
分布式·微服务·gateway
云和数据.ChenGuang3 天前
`neutron router-gateway-set` 操作失败的可能原因及解决方案
运维·gateway·运维技术总结·运维技术
要开心吖ZSH5 天前
【Spring Cloud Gateway 实战系列】终极篇:演进方向与未来架构
spring cloud·gateway
@小了白了兔6 天前
统一服务入口——Spring Cloud Gateway
java·spring cloud·gateway
要开心吖ZSH6 天前
【Spring Cloud Gateway 实战系列】进阶篇:过滤器高级用法、动态路由配置与性能优化
spring cloud·性能优化·gateway·负载均衡
亲爱的非洲野猪7 天前
Spring Cloud Gateway 电商系统实战指南:架构设计与深度优化
java·spring cloud·gateway