K8S上部署Ingress+Traefik教程

2019-01-15  本文已影响0人  Firetheworld

Ingress+Traefik介绍:

导入相关的yaml文件以及docker images

[root@k8s-node10-18-223-243 traefik]# ll
总用量 51320
-rw-r--r-- 1 root root      986 9月  26 11:43 dspod.yaml
-rwxrwxrwx 1 root root       56 9月  26 10:36 eage.sh
-rw-r--r-- 1 root root      194 6月  26 16:52 ingress-lb.yaml
-rw-r--r-- 1 root root      460 5月  22 17:23 ingress.yaml
-rw-r--r-- 1 root root      104 5月  22 16:18 namespace.yaml
-rw-r--r-- 1 root root      357 5月  22 16:15 rbac.yaml
-rw-r--r-- 1 root root       86 5月  22 16:39 sa.yaml
-rw-r--r-- 1 root root 52516352 7月   4 13:32 traefik.latest.tar
[root@k8s-node10-18-223-243 traefik]# cat ingress.yaml 
apiVersion: v1
kind: Service
metadata:
  name: traefik-web-ui
  namespace: zteict-k8s
spec:
  selector:
    k8s-app: traefik-ingress-lb
  ports:
  - name: web
    port: 80
    targetPort: 8580
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-web-ui
  namespace: zteict-k8s
spec:
  rules:
  - host: traefik-ui.k8s
    http:
      paths:
      - path: /
        backend:
          serviceName: traefik-web-ui
          servicePort: web
[root@k8s-node10-18-223-243 traefik]# cat ingress.yaml  | grep host
  - host: traefik-ui.k8s
[root@k8s-node10-18-223-243 traefik]# cat dspod.yaml |grep hostname
        kubernetes.io/hostname: k8s-node10-18-223-243
[root@k8s-node10-18-223-243 traefik]# cat eage.sh 
kubectl label nodes k8s-node10-18-223-243 edgenode=true
[root@k8s-node10-18-223-243 traefik]# chmod +x eage.sh &&  ./eage.sh
node/k8s-node10-18-223-24 labeled
[root@k8s-node10-18-223-243 traefik]# kubectl apply -f .
deployment.extensions/traefik-ingress-lb created
service/traefik-web-ui created
service/traefik-web-ui unchanged
ingress.extensions/traefik-web-ui created
namespace/zteict-k8s configured
serviceaccount/ingress unchanged
clusterrolebinding.rbac.authorization.k8s.io/ingress configured
serviceaccount/ingress unchanged
上一篇 下一篇

猜你喜欢

热点阅读