您好,登錄后才能下訂單哦!
這篇文章主要介紹“kong在kubernetes中的安裝及使用方法”,在日常操作中,相信很多人在kong在kubernetes中的安裝及使用方法問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對(duì)大家解答”kong在kubernetes中的安裝及使用方法”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!
參考官方網(wǎng)站:
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,外網(wǎng)不能訪問 type: ClusterIP http: enabled: true servicePort: 8001 containerPort: 8001 # 私有k8s。導(dǎo)出 NodePort proxy: type: NodePort http: nodePort: 30002 tls: nodePort: 30000 postgresql: enabled: true persistence: storageClass: rook-cephfs accessModes: - ReadWriteMany postgresqlUsername: kong postgresqlDatabase: kong # 固定密碼,不隨機(jī) postgresqlPassword: Kong.=2021! postgresqlPostgresPassword: Kong.=2021! service: port: 5432 ingressController: enabled: true installCRDs: false
安裝kong
# 安裝到默認(rèn)default空間 helm install kong kong/kong -f minimal-kong-standalone.yaml helm upgrade kong kong/kong -f minimal-kong-standalone.yaml
安裝konga。konga是UI庫,調(diào)用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運(yùn)行后效果
kong的prometheus監(jiān)控。首先在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。默認(rèn)創(chuàng)建的prometheus使用此標(biāo)簽來識(shí)別 labels: release: prometheus spec: # 不在同一命名空間,加上namespaceSelector namespaceSelector: matchNames: - default # 匹配的service的標(biāo)簽 selector: matchLabels: app.kubernetes.io/name: kong endpoints: # service中對(duì)應(yīng)的端口名稱 - port: kong-admin
到此,關(guān)于“kong在kubernetes中的安裝及使用方法”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。