helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

nodeport or hostpoat support?

Open lonelyleaf opened this issue 6 years ago • 4 comments

nodeport or hostport is useful in debug or daliy maintenance from pc. I try to write a nodeport servcie ,but sometimes get error like

cannot execute CREATE TABLE in a read-only transaction

How to write a correct nodeport service?And can you add offical support for it.

lonelyleaf avatar Dec 18 '19 03:12 lonelyleaf

I'm not sure if we want to support it directly in these Helm Charts, we'll take it into consideration before going to version 1.0.

How do you currently define the current NodePort service, what selector do you give it?

feikesteenbergen avatar Jan 17 '20 16:01 feikesteenbergen

I just change the default service to nodeport like below.

apiVersion: v1
kind: Service
metadata:
  name: timescaledb-single
  namespace: timescaledb-single
spec:
  externalTrafficPolicy: Cluster
  ports:
    - name: postgresql
      nodePort: 31577
      port: 5432
      protocol: TCP
      targetPort: postgresql
  sessionAffinity: None
  type: Nodeport

Since patroni use endpoint to manage the leader metadata,I didn't find a way to use selector to connect to master database.

lonelyleaf avatar Jan 18 '20 01:01 lonelyleaf

This would be useful to avoid a port-forward for development use.

invernizzie avatar Aug 13 '20 18:08 invernizzie

Hello, I'm failing to expose Timescale with a NodePort instead of a LoadBalancer.

Here's what I tried.

First approach: full Helm

Here are the values.yml that I tried:

replicaCount: 1
service:
  primary:
    type: NodePort
    nodePort: 30001
  replica:
    type: ClusterIP
  loadBalancer:
    enabled: false

Here are the services that the Helm release creates when applied:

NAMESPACE                 NAME                                                  TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
flux-system               timescaledb                                           LoadBalancer   10.42.142.161   51.159.9.15   5432:30905/TCP           9m44s
flux-system               timescaledb-config                                    ClusterIP      None            <none>        8008/TCP                 20m
flux-system               timescaledb-replica                                   ClusterIP      10.33.227.237   <none>        5432/TCP                 20m

Problems with this approach

  • [ ] I can't find how to use a NodePort instead of a LoadBalancer solely by editing the Helm chart values.

Second approach: creating a NodePort service

I create the following service:

kind: Service
apiVersion: v1
metadata:
  name: timescaledb-svc
  namespace: flux-system
spec:
  selector:
    app: timescaledb
    role: master
  type: NodePort
  externalIPs:
    - "51.15.223.40"
  ports:
    - name: timescale-pg-port
      port: 5432
      nodePort: 30001

I deleted the previously created LoadBalancer:

kubectl delete service timescaledb -n flux-system

I get the following services:

NAME                      TYPE        CLUSTER-IP      EXTERNAL-IP    PORT(S)          AGE
timescaledb-config        ClusterIP   None            <none>         8008/TCP         40m
timescaledb-replica       ClusterIP   10.33.227.237   <none>         5432/TCP         40m
timescaledb-svc           NodePort    10.41.23.237    51.15.223.40   5432:30001/TCP   3m

Problems with this approach

I can connect using port-forwarding. The problems are related to exposing the port to the Internet.

  • [ ] It looks like I can access the port at 51.15.223.40:30001, but it times out (see screenshot). Why does this happen?
  • [ ] How can I expose the NodePort on all cluster nodes instead of one? Manually selecting an external IP seems wrong to me.

Timeout

image

Provider

My provider is Kapsule from Scaleway.

clouedoc avatar Dec 23 '21 00:12 clouedoc