DEV Community

Guilherme Sousa
Guilherme Sousa

Posted on

2 1

Adicionar um novo mapeamento de porta a um cluster K3D existente

Considerando que o seguinte serviço foi criado:

apiVersion: v1
kind: Service
metadata:
  name: postgres-outside-cluster
  namespace: default
spec:
  type: NodePort
  selector:
    app: postgres
    replicationRole: primary
  ports:
  - name: port-5432
    protocol: TCP
    port: 5432
    targetPort: 5432
    nodePort: 30543
Enter fullscreen mode Exit fullscreen mode

Ao executar o comando abaixo será possível acessar, no host, o postgres via localhost:5432:

k3d cluster edit k3s-default --port-add 5432:30543@server:0

Onde k3s-default é o nome do cluster, 5432 é a porta do host e 30543 é a porta do node.

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay