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
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: traefik-ingress-controller
  namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: traefik-conf
  namespace: kube-system
data:
  traefik.toml: |
    insecureSkipVerify = true
    defaultEntryPoints = ["http","https"]
    [entryPoints]
      [entryPoints.http]
      address = ":80"
      [entryPoints.https]
      address = ":443"
        [entryPoints.https.tls]
          [[entryPoints.https.tls.certificates]]
          CertFile = "/ssl/tls.crt"
          KeyFile = "/ssl/tls.key"
---
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
  name: traefik-ingress-controller
  namespace: kube-system
  labels:
    k8s-app: traefik-ingress-lb
spec:
  template:
    metadata:
      labels:
        k8s-app: traefik-ingress-lb
        name: traefik-ingress-lb
    spec:
      serviceAccountName: traefik-ingress-controller
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      terminationGracePeriodSeconds: 60
      hostNetwork: true
      volumes:
      - name: ssl
        secret:
          secretName: ssl
      - name: config
        configMap:
          name: traefik-conf
      containers:
      - image: k8s.gcr.io/traefik:1.7.5
        name: traefik-ingress-lb
        ports:
        - name: http
          containerPort: 80
          hostPort: 80
        - name: admin
          containerPort: 8080
        securityContext:
          privileged: true
        args:
        - --configfile=/config/traefik.toml
        - -d
        - --web
        - --kubernetes
        volumeMounts:
        - mountPath: "/ssl"
          name: "ssl"
        - mountPath: "/config"
          name: "config"
---
kind: Service
apiVersion: v1
metadata:
  name: traefik-ingress-service
spec:
  selector:
    k8s-app: traefik-ingress-lb
  ports:
    - protocol: TCP
      port: 80
      name: web
    - protocol: TCP
      port: 8080
      name: admin
    - protocol: TCP
      port: 443
      name: https
  type: NodePort
apiVersion: v1
kind: Service
metadata:
  name: traefik-web-ui
  namespace: kube-system
spec:
  selector:
    k8s-app: traefik-ingress-lb
  ports:
  - port: 80
    targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-web-ui
  namespace: kube-system
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: ingress.your.com
    http:
      paths:
      - backend:
          serviceName: traefik-web-ui
          servicePort: 80

1 对 “kubernetes部署traefik-ingress工具”的想法;

  1. apiVersion: v1
    data:
      tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZqRENDQTNRQ0NRQ2Zra1NZYzFHVnBEQU5CZ2txaGtpRzl3MEJBUXNGQURDQmh6RUxNQWtHQTFVRUJoTUMKUTA0eERqQU1CZ05WQkFnTUJVaDFZbVZwTVE0d0RBWURWUVFIREFWWGRXaGhiakVPTUF3R0ExVUVDZ3dGYzJsdApZV2t4RGpBTUJnTlZCQXNNQlhOcGJXRnBNUmN3RlFZRFZRUUREQTRxTG5OcGJXRnBMbWRzYjJKaGJERWZNQjBHCkNTcUdTSWIzRFFFSkFSWVFaR1YyUUhOcGJXRnBMbWRzYjJKaGJEQWVGdzB4T1RBM01qWXhOekEwTXpoYUZ3MHkKT1RBM01qTXhOekEwTXpoYU1JR0hNUXN3Q1FZRFZRUUdFd0pEVGpFT01Bd0dBMVVFQ0F3RlNIVmlaV2t4RGpBTQpCZ05WQkFjTUJWZDFhR0Z1TVE0d0RBWURWUVFLREFWemFXMWhhVEVPTUF3R0ExVUVDd3dGYzJsdFlXa3hGekFWCkJnTlZCQU1NRGlvdWMybHRZV2t1WjJ4dlltRnNNUjh3S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0QWs1SUppMjFHQXFhR0FlbGdzTkVXeGFINUJKQkpwZkwKdm8yajN2dEE2ZVdOMk55djFidWp3ZEUxRG5BbnlLVT0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo=
    kind: Secret
    metadata:
      name: ssl
      namespace: kube-system
    type: kubernetes.io/tls
    
    

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code