简体   繁体   English

如何访问部署在 Kubernetes 集群上的 postgresql

[英]How to access postgresql, deployed on Kubernetes cluster

I have deployed postgresql pod on kubernetes pod, and want to know how can I access postgresql gui.我已经在 kubernetes pod 上部署了 postgresql pod,并且想知道如何访问 postgresql gui。 I am not able to access it with ingress path, as I got to know ingress are meant for https purpose only whereas postgres follows TCP protocol.我无法通过入口路径访问它,因为我知道入口仅用于 https 目的,而 postgres 遵循 TCP 协议。 Any lead how can I access through GUI?任何线索我如何通过 GUI 访问?

deployment.yaml部署.yaml

---
  apiVersion: "apps/v1"
  kind: "Deployment"
  metadata: 
    name: "postgresql-development"
    namespace: "development"
  spec: 
    selector: 
      matchLabels: 
        app: "postgresql-development"
    replicas: 1
    strategy: 
      type: "RollingUpdate"
      rollingUpdate: 
        maxSurge: 1
        maxUnavailable: 1
    minReadySeconds: 5
    template: 
      metadata: 
        labels: 
          app: "postgresql-development"
          tier: "mysql"
      spec: 
        containers: 
          - 
            name: "postgresql-development"
            image: "postgresql:12.6"
            imagePullPolicy: "Always"
            env: 
              - 
                name: "POSTGRES_USER"
                value: "postgres"
            ports: 
              - 
                containerPort: 5432
                name: "postgres"
                
            volumeMounts: 
              - 
                name: "postgresql-persistent-storage"
                mountPath: "/var/lib/postgresql"
                
        volumes: 
          - 
            name: "postgresql-persistent-storage"
            persistentVolumeClaim: 
              claimName: "postgresql-pvc-development"


                
        imagePullSecrets: 
          - 
            name: "postgresql"

service.yaml服务.yaml

---
  apiVersion: "v1"
  kind: "Service"
  metadata: 
    name: "postgresql-development"
    namespace: "development"
    labels: 
      app: "postgresql-development"
      app.kubernetes.io/name: ingress-nginx
      app.kubernetes.io/part-of: ingress-nginx
  spec: 
    ports: 
      - 
        port: 59799
        targetPort: 5432
        protocol: TCP
    selector: 
      app: "postgresql-development"
      app.kubernetes.io/name: ingress-nginx
      app.kubernetes.io/part-of: ingress-nginx
      tier: mysql

ingress.yaml入口.yaml

---
  apiVersion: "networking.k8s.io/v1beta1"
  kind: "Ingress"
  metadata: 
    name: "postgresql-development-ingress"
    namespace: "development"
    annotations: 
      nginx.ingress.kubernetes.io/rewrite-target: "/$1"
  spec: 
    rules: 
      - 
        host: "localhost"
        http: 
          paths: 
            - 
              backend: 
                serviceName: "postgresql-development"
                servicePort: 59799
              path: "postgresql-development/(.*)"

Ingress API are only for Layer 7 (HTTP).入口 API 仅适用于第 7 层 (HTTP)。 In your case you want to access Layer 4 (TCP).在您的情况下,您想要访问第 4 层 (TCP)。

To achieve you goal, you can:为了实现您的目标,您可以:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何开放对部署在 okteto 上的 postgresql 的公共访问? - How to open public access to postgresql deployed on okteto? 如何更新部署在 Kube.netes pod 上的 postgresql 中的 max_connections - How to update max_connections in postgresql deployed on Kubernetes pod Kubernetes + Django / PostgreSQL-将PostgreSQL数据库部署到Kubernetes集群时如何指定HOST - Kubernetes + Django / PostgreSQL - How do I specify HOST of my PostgreSQL Database when I deploy it to Kubernetes Cluster 访问Kubernetes集群的Postgresql数据 - Accessing Postgresql data of Kubernetes cluster 如何使用Docker / Kubernetes为PostgreSQL故障转移群集建模? - How do I model a PostgreSQL failover cluster with Docker/Kubernetes? 如何在Postgresql中仅允许访问Kubernetes Pod? - How to allow access only for kubernetes pods in postgresql? 将 SQLite 转储迁移到部署在 Kubernetes 上的 PostgreSQL - Migrate SQLite dump to PostgreSQL deployed on Kubernetes 如何执行脚本以在Kubernetes集群上部署的postgres中导入csv文件? - How to execute scripts to import csv files inside a postgres deployed on a Kubernetes cluster? 如何在本地访问只能从 Kubernetes 集群访问的数据库? - How to access a database that is only accesible from Kubernetes cluster locally? 无法连接到 Kubernetes 集群上的远程 postgreSQL 数据库 - Cannot connect to remote postgreSQL database on Kubernetes cluster
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM