温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2022-01-05 09:21:10 来源:亿速云 阅读:308 作者:柒染 栏目:云计算

今天就跟大家聊聊有关openfaas笔记备忘录怎么使用traefik 发布访问,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

(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

访问

curl  http://openfaas.ghac.xyz/function/gin-demo/ping

(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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUR1ekNDQXFPZ0F3SUJBZ0lKQU10NUZIcjNWcStJTUEwR0NTcUdTSWIzRFFFQkN3VUFNSFF4Q3pBSkJnTlYKQkFZVEFrZGFNUXN3Q1FZRFZRUUlEQUpIUkRFTE1Ba0dBMVVFQnd3Q1Ixb3hEVEFMQmdOVkJBb01CRWRJUVVNeApEVEFMQmdOVkJBc01CRWRJUVVNeEVqQVFCZ05WQkFNTUNXeHZZMkZzYUc5emRERVpNQmNHQ1NxR1NJYjNEUUVKCkFSWUtiMkZBWj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RcEIKVWU2MmhOL0M5SXMzWUgxQms5NldoVytPcllzRUs0MUR6ajIrQ05QU1JMVllFZjN2SDBYRFlqYWhBb0dCQUk1agpLUUM5U2kxZHp5Z1hPZ2JvcktOTi8xQm1QbkJ3cjNJU0dZd2puTmxPbll2US95dldnZEQzQndSd1ZULzFOSnNOCm5uNTJ0R2FmMUxUdVB4QnlYM3dFTUJzeTd1R253U2dmazF5YjM5eWZIK3JIL0duT0ZwWWt4eUwzcnZtdCs3eTEKRGxZTmNIbFNOU1Z1aVZxTkJIZkt6cUxCNEV4dG90SUdrZDB0TlJxMUFvR0FGZnZpQ21iRVN0Y1k2anRDZnRFUQpOTlVoaC9RL2RkMXNZRXZZdmUyTkdieDhQbkNaeGhZenZNYWtjNWhvdGxYOXpPTExFd0NNaXVHMXVyR0d5OGcwCndmaXpvVEZRdWh5OC8xdFhDRVRCdlNaRFlyZ0dTa21CNHN0V04xaGJCL3VqVlJhWWoyQnJlVUxhWWRDQkIvbUQKeU5uR01ac2IvQmJLb05yQ2FDam5Rbk09Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
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

访问

curl -k  https://openfaas.ghac.xyz/function/gin-demo/ping  

(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

看完上述内容,你们对openfaas笔记备忘录怎么使用traefik 发布访问有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI