-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用k3d快速创建一个kubernetes集群 #2
Comments
ingress.yaml apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`traefik.example.com`)
kind: Rule
services:
- name: api@internal
kind: TraefikService
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
# traefik.ingress.kubernetes.io/router.middlewares: default-stripprefix@kubernetescrd
spec:
rules:
- host: nginx.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx
port:
number: 80
- host: tomcat.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: tomcat
port:
number: 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
安装文档
https://k3d.io/
https://k3s.io/
https://doc.traefik.io/traefik/
安装k3d
创建集群
此处使用--registry-config配置镜像仓库认证。文档地址:https://k3d.io/v5.1.0/usage/registries/#registries-file
常用参数:
--k3s-arg : 文档地址:https://rancher.com/docs/k3s/latest/en/installation/install-options/server-config/#k3s-server-cli-help
可选的组件有:coredns, servicelb, traefik, local-storage, metrics-server
如:--k3s-arg "--disable=traefik@server:0"
registries.yaml
注:"registry.cn-beijing.aliyuncs.com" 名字保持一致
不想使用默认flannel的可以选择其他网络组件.如:calico
参考:https://github.com/rancher/k3d/blob/main/docs/usage/advanced/calico.md
创建ingress
访问traefik dashboard
kubectl -n kube-system port-forward $(kubectl -n kube-system get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000
浏览器访问:http://localhost:9000/dashboard/
参考文档
Traefik 路由规则及中间件 Traefik Middlewares 的配置
https://doc.traefik.io/traefik/providers/overview/
https://doc.traefik.io/traefik/routing/providers/kubernetes-ingress/
https://doc.traefik.io/traefik/middlewares/overview/
The text was updated successfully, but these errors were encountered: