Skip to content

Instantly share code, notes, and snippets.

@gifflet
Last active August 10, 2023 15:06
Show Gist options
  • Save gifflet/4915b33f1e165eabd61c39c96378257b to your computer and use it in GitHub Desktop.
Save gifflet/4915b33f1e165eabd61c39c96378257b to your computer and use it in GitHub Desktop.
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

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 5432 é a porta do host e 30543 é a porta do node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment