openfaas 笔记备忘录 使用 traefik 发布访问

原创
04/03 17:18
阅读数 114

(1) http发布访问

vi  traefik-openfaas-ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: openfaas-gateway-ingress
  namespace: openfaas
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: openfaas.ghac.xyz
    http:
      paths:
      - backend:
          serviceName: gateway
          servicePort: 8080
kubectl apply -f traefik-openfaas-ingress.yaml
 
修改 /etc/hosts
127.0.0.1 openfaas.ghac.xyz
 
访问

(2) https 发布访问

vi traefik-openfaas-ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: openfaas-gateway-ingress
  namespace: openfaas
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: openfaas.ghac.xyz
    http:
      paths:
      - backend:
          serviceName: gateway
          servicePort: 8080
  tls:
    - secretName: openfaas-traefik-tls-cert
---
apiVersion: v1
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUR1ekNDQXFPZ0F3SUJBZ0lKQU10NUZIcjNWcStJTUEwR0NTcUdTSWIzRFFFQkN3VUFNSFF4Q3pBSkJnTlYKQkFZVEFrZGFNUXN3Q1FZRFZRUUlEQUpIUkRFTE1Ba0dBMVVFQnd3Q1Ixb3hEVEFMQmdOVkJBb01CRWRJUVVNeApEVEFMQmdOVkJBc01CRWRJUVVNeEVqQVFCZ05WQkFNTUNXeHZZMkZzYUc5emRERVpNQmNHQ1NxR1NJYjNEUUVKCkFSWUtiMkZBWjJoaFl5NWpiakFlRncweE9URXhNamN3T0RRME1EQmFGdzB5TURFeE1qWXdPRFEwTURCYU1IUXgKQ3pBSkJnTlZCQVlUQWtkYU1Rc3dDUVlEVlFRSURBSkhSREVMTUFrR0ExVUVCd3dDUjFveERUQUxCZ05WQkFvTQpCRWRJUVVNeERUQUxCZ05WQkFzTUJFZElRVU14RWpBUUJnTlZCQU1NQ1d4dlkyRnNhRzl6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ZIK3JIL0duT0ZwWWt4eUwzcnZtdCs3eTEKRGxZTmNIbFNOU1Z1aVZxTkJIZkt6cUxCNEV4dG90SUdrZDB0TlJxMUFvR0FGZnZpQ21iRVN0Y1k2anRDZnRFUQpOTlVoaC9RL2RkMXNZRXZZdmUyTkdieDhQbkNaeGhZenZNYWtjNWhvdGxYOXpPTExFd0NNaXVHMXVyR0d5OGcwCndmaXpvVEZRdWh4OC8xdFhDRVRCdlNaRFlyZ0dTa21CNHN0V04xaGJCL3VqVlJhWWoyQnJlVUxhWWRDQkIvbUQKeU5uR01ac2IvQmJLb05yQ2FDam5Rbk09Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
kind: Secret
metadata:
  name: openfaas-traefik-tls-cert
  namespace: openfaas
type: Opaque
kubectl apply -f traefik-openfaas-ingress.yaml
 
修改 /etc/hosts
127.0.0.1 openfaas.ghac.xyz
 
访问
 

(3) prometheus

 

vi openfaas-prometheus-ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: openfaas-prometheus-ingress
  namespace: openfaas
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: openfaas.prometheus.ghac.xyz
    http:
      paths:
      - backend:
          serviceName: prometheus
          servicePort: 9090

kubectl apply -f  openfaas-prometheus-ingress.yaml

修改 /etc/hosts
127.0.0.1 openfaas.prometheus.ghac.xyz
 
访问 http://openfaas.prometheus.ghac.xyz/ui

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部