K8S运维笔记-安装traefik-ingress
所有运维资料都在HDIS-Solution中能找到,欢迎star。同时也欢迎关注我的微服务Framework:HDIS-Framework,欢迎star。K8S运维笔记-部署traefik-ingress运行traefik-rbac---kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1beta1metadata:...
·
HDIS-Framework
HDIS-Framework是一个基于SpringBoot、Kubernetes、阿里云服务,编写的一个用于支撑微服务的极速开发框架。
其文档详尽,Demo全面,设计合理,开箱即用,节省开发时间,提升开发效率。
配套的docker、Kubernetes教程已踩过各种坑,让你的微服务无障碍的顺畅运行起来。
HDIS与Kubernetes或SpringCloud配合使用,能达到最佳效果。
K8S运维笔记-安装traefik-ingress
运行traefik-rbac
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-ingress-controller
subjects:
- kind: ServiceAccount
name: traefik-ingress-controller
namespace: kube-system
运行traefik-deployment
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: traefik-ingress-controller
namespace: kube-system
labels:
k8s-app: traefik-ingress-lb
spec:
replicas: 1
selector:
matchLabels:
k8s-app: traefik-ingress-lb
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 60
containers:
- image: traefik
name: traefik-ingress-lb
ports:
- name: http
containerPort: 80
- name: admin
containerPort: 8080
args:
- --api
- --kubernetes
- --logLevel=INFO
---
kind: Service
apiVersion: v1
metadata:
name: traefik-ingress-service
namespace: kube-system
spec:
type: NodePort
selector:
k8s-app: traefik-ingress-lb
ports:
- protocol: TCP
name: web
targetPort: 80
port: 80
NodePort: 80
- protocol: TCP
name: admin
targetPort: 8080
port: 8080
NodePort: 8080
运行traefik-ui
---
apiVersion: v1
kind: Service
metadata:
name: traefik-web-ui
namespace: kube-system
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- name: web
targetPort: 8080
port: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-web-ui
namespace: kube-system
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/rule-type: PathPrefixStrip
spec:
rules:
- host: www.wowgo.ink #这里改成你的host
http:
paths:
- path: /traefik
backend:
serviceName: traefik-web-ui
servicePort: web
访问地址
http://www.wowgo.ink/traefik
参考资料
//traefik与k8s集成官方文档
https://docs.traefik.io/user-guide/kubernetes/
更多推荐
已为社区贡献2条内容
所有评论(0)