根据上一篇博客,我们已经安装好kong,链接:https://blog.csdn.net/cyhelloyes/article/details/100316522

如果选择的是开通云平台Postgres服务,这里还需要创建konga数据库(在k8s上面自建Postgres服务的话则不需要手动创建数据库)

postgres=# create database k8s_konga owner pointsmart_ops ;

Command OK

postgres=# grant all on database k8s_konga to pointsmart_kong;

 

cat >  konga_dasboard.yaml   <<EOF
apiVersion: v1
kind: Service
metadata:
  name: konga
spec:
  ports:
  - name: konga
    port: 1337
    targetPort: 1337
    protocol: TCP
  selector:
    app: konga

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: konga
spec:
  replicas: 2
  template:
    metadata:
      labels:
        name: konga
        app: konga
    spec:
      containers:
      - name: konga
        image: pantsel/konga:0.14.1
        env:
          - name: DB_DATABASE
            value: k8s_konga
          - name: DB_USER
            value: pointsmart_kong
          - name: DB_PASSWORD
            value: xxxxxx
          - name: DB_PORT
            value: "3306"
          - name: DB_ADAPTER
            value: postgres
          - name: DB_HOST
            value: postgres
        ports:
        - name: konga
          containerPort: 1337
          protocol: TCP
EOF

[root@bdy-master1 ]# kubectl create -f konga_dasboard.yaml

如果使用的ingress是traefik的话,可以用域名方式访问konga

cat > traefik-konga.yaml  <<EOF
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: konga-idiom
spec:
  tls:
    - secretName: ingress-secret-idiom-cn 
  rules:
  - host: konga.idiomroot.com
    http:
      paths: 
      - backend:
          serviceName: konga
          servicePort: 1337
EOF

 

konga正常运行之后,登录界面,创建管理用户,设置连接kong

 

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐