当前位置:网站首页>helm 部署traefik ingress
helm 部署traefik ingress
2022-06-11 01:48:00 【周易不易】
1、添加traefik helm仓库
$ helm repo add traefik https://helm.traefik.io/traefik
$ helm repo update2、下载到本地
$ helm search repo traefik
NAME CHART VERSION APP VERSION DESCRIPTION
traefik/traefik 10.20.1 2.7.0 A Traefik based Kubernetes ingress controller
$ helm pull traefik/traefik3、部署Traefik
3.1 修改values
#type: LoadBalancer
type: ClusterIP
ports:
traefik:
port: 8080
hostPort: 8080
exposedPort: 8080
expose: true
protocol: TCP
添加
additionalArguments:
- "--serversTransport.insecureSkipVerify=true"
- "--api.insecure=true"
- "--api.dashboard=true"
或者简单点
完整配置如下
==================================
service:
type: ClusterIP
ingressRoute:
dashboard:
enabled: false
nodeSelector:
kubernetes.io/hostname: k8snode1
ports:
web:
hostPort: 80
websecure:
hostPort: 443
traefik:
port: 8080
hostPort: 8080
exposedPort: 8080
expose: true
additionalArguments:
- "--serversTransport.insecureSkipVerify=true"
- "--api.insecure=true"
- "--api.dashboard=true"3.2 部署
$ helm install traefik traefik/traefik -f values.yaml -n kube-system #部署
其他命令
$ helm upgrade traefik traefik/traefik -n kube-system #更新
$ helm uninstall traefik -n kube-system # 卸载 traefik
#查看状态
$ helm list -n kube-system
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
traefik kube-system 1 2022-06-07 15:05:58.300911179 +0800 CST deployed traefik-10.20.1 2.7.0
$ helm status traefik -n kube-system
NAME: traefik
LAST DEPLOYED: Tue Jun 7 15:05:58 2022
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
4 创建路由规则
4.1原生Ingress路由规则
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: traefik-dashboard-ingress
namespace: kube-system
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
rules:
- host: traefik.ingress.cn
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: traefik
port:
number: 8080
4.2 使用CRD方式配置路由规则
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard-route
namespace: kube-system
spec:
entryPoints:
- web
routes:
- match: Host(`traefikroute.ingress.cn`)
kind: Rule
services:
- name: traefik
port: 8080
namespace: kube-system #要和traefik ingress所在的命名空间一致,就可以正常访问,
如:http://traefikroute.ingress.cn/dashboard/#/
否则访问需要添加expose里设置的端口;如http://traefikroute.ingress.cn:8080/
5 访问
http://traefik.ingress.com
http://traefik.ingress.com/dashboard6 验证
暴露HTTP服务
#创建pod和svc
cat > whoami.yaml << EOF
---
apiVersion: v1
kind: Pod
metadata:
name: whoami
labels:
app: whoami
spec:
containers:
- name: whoami
image: traefik/whoami:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: whoami
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: whoami
type: ClusterIP
EOF
==========================
创建一个路由规则,使外部可以访问
cat > whoami-ingressroute.yaml << EOF
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: whoami-route
spec:
entryPoints:
- web
routes:
- match: Host(`whoami.ingress.cn`)
kind: Rule
services:
- name: whoami
port: 80
EOF浏览器访问 whoami.ingress.cn


个人总结:
1、其他通过traefik代理的资源应用pod,service并不需要与traefik在同一个命名空间,也就是命名空间对traefik代理来说并没有限制


以上两个实例都不在traefik ingress的命名空间里
2、但是部署实例的pod service 路由规则 都需要在同一个命名空间里
边栏推荐
- The largest kth element in the array
- Les produits financiers de l'assurance - rente peuvent - ils être composés? Quel est le taux d'intérêt?
- Setting access to win10 shared folder without verification
- APP测试_测试点总结
- 关于Set集合类你都知道什么?来自《卷Ⅰ》的灵魂提问
- What can the enterprise exhibition hall design bring to the enterprise?
- Blue Bridge Cup: the sixth preliminary round - "temperature recorder"
- Colab报错:ImportError: cannot import name ‘_check_savefig_extra_args‘ from ‘matplotlib.backend_bases‘
- 企业展厅设计能为企业带来什么?
- 为什么有的程序员能力一般却能拿到好offer?
猜你喜欢

ADVANCE. AI CEO Shoudong will share the compliance of cross-border e-commerce using AI technology at the 2022 emerging market brands online Summit

SD3.0笔记

Project load failed

SQL | 计算总和

MySQL backup and recovery

如何保障数仓数据质量?

Jetpack Compose Box控件

421. 数组中两个数的最大异或值

Epoll principle and Application & ET mode and lt mode

Everything实现快速搜索的原理
随机推荐
What is the relationship between precious metal silver and spot Silver
渗透测试-安全服务体系+OWASP top 10
SQL | external connection
MOFs, metal organic framework materials of folic acid ligands, are loaded with small molecule drugs such as 5-fluorouracil, sidabelamine, taxol, doxorubicin, daunorubicin, ibuprofen, camptothecin, cur
ADVANCE.AI首席执行官寿栋将在2022新兴市场品牌出海线上峰会分享跨境电商运用AI技术合规
軟件測試英語常見詞匯
Multilevel mesoporous organometallic framework material zif-8 loaded with lactic acid oxidase (LOD) / ferric oxide (Fe304) / doxorubicin / insulin /cas9 protein / metronidazole / emodin methyl ether
Technology sharing | quick intercom, global intercom
Closing method of SQL injection
Cyclodextrin metal organic framework( β- Cd-mof) loaded with dimercaptosuccinic acid / emodin / quercetin / sucralose / diflunisal / omeprazole (OME)
【189. 轮转数组】
The largest kth element in the array
Everything实现快速搜索的原理
P4338 [ZJOI2018]历史(树剖)(暴力)
Principle of everything for fast search
Knowledge competition of safety production month -- how much do you know about new safety law
Why is the trend chart of precious metal silver strong?
Redis learning notes (continuously updating)
List 过滤、排序、校验等处理方法
查看Redis内数据,除了命令行和客户端,你还有第三种选择