kong在kubernetes中的安装及使用方法
这篇文章主要介绍“kong在kubernetes中的安装及使用方法”,在日常操作中,相信很多人在kong在kubernetes中的安装及使用方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”kong在kubernetes中的安装及使用方法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
在加查等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站建设、网站设计 网站设计制作按需定制网站,公司网站建设,企业网站建设,成都品牌网站建设,营销型网站建设,外贸网站制作,加查网站建设费用合理。
参考官方网站:
https://github.com/Kong/kubernetes-ingress-controller
https://github.com/Kong/charts
https://blog.csdn.net/qianghaohao/article/details/99691727
使用helm安装
下载适合的helm example https://github.com/Kong/charts/tree/main/charts/kong/example-values
本次下载
wget https://raw.githubusercontent.com/Kong/charts/main/charts/kong/example-values/minimal-kong-standalone.yaml
-参考修改后配置 minimal-kong-standalone.yaml
image: repository: kong tag: "2.3" env: prefix: /kong_prefix/ database: postgres admin: enabled: true # 修改ClusterIP,外网不能访问 type: ClusterIP http: enabled: true servicePort: 8001 containerPort: 8001 # 私有k8s。导出 NodePort proxy: type: NodePort http: nodePort: 30002 tls: nodePort: 30000 postgresql: enabled: true persistence: storageClass: rook-cephfs accessModes: - ReadWriteMany postgresqlUsername: kong postgresqlDatabase: kong # 固定密码,不随机 postgresqlPassword: Kong.=2021! postgresqlPostgresPassword: Kong.=2021! service: port: 5432 ingressController: enabled: true installCRDs: false
安装kong
# 安装到默认default空间 helm install kong kong/kong -f minimal-kong-standalone.yaml helm upgrade kong kong/kong -f minimal-kong-standalone.yaml
安装konga。konga是UI库,调用kong-admin来管理kong https://github.com/pantsel/konga
apiVersion: apps/v1 kind: Deployment metadata: name: konga labels: app: konga spec: replicas: 1 selector: matchLabels: app: konga template: metadata: labels: app: konga spec: containers: - env: - name: DB_ADAPTER value: postgres - name: DB_URI # kong-postgresql为service name value: "postgresql://kong:Kong.=2021!@kong-postgresql:5432/konga_database" image: pantsel/konga imagePullPolicy: Always name: konga ports: - containerPort: 1337 protocol: TCP restartPolicy: Always --- apiVersion: v1 kind: Service metadata: name: konga spec: ports: - name: http port: 1337 targetPort: 1337 protocol: TCP selector: app: konga --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: konga-ingress annotations: kubernetes.io/ingress.class: kong spec: rules: - host: konga.your_domain.com http: paths: - path: / pathType: ImplementationSpecific backend: service: name: konga port: number: 1337
konga运行后效果
kong的prometheus监控。首先在konga中启用prometheus
安装prometheus的ServiceMonitor。prometheus安装参考 https://my.oschina.net/u/160697/blog/3197715
apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: prometheus-kong # 需固定release: prometheus。默认创建的prometheus使用此标签来识别 labels: release: prometheus spec: # 不在同一命名空间,加上namespaceSelector namespaceSelector: matchNames: - default # 匹配的service的标签 selector: matchLabels: app.kubernetes.io/name: kong endpoints: # service中对应的端口名称 - port: kong-admin
到此,关于“kong在kubernetes中的安装及使用方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
网页标题:kong在kubernetes中的安装及使用方法
分享URL:http://ybzwz.com/article/jpeigd.html