Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service clusterip: none , is this normal? #144

Open
gaetanquentin opened this issue Jan 2, 2023 · 3 comments
Open

service clusterip: none , is this normal? #144

gaetanquentin opened this issue Jan 2, 2023 · 3 comments

Comments

@gaetanquentin
Copy link

Hi,

after installing postgres with kubegres i see there is no ips on service mypostgres/mypostgres-replica.
How can this work?

kubernetes: MicroK8s v1.25.4 revision 4221
kubegres: 1.16

Steps:
1. kubectl apply -f https://raw.githubusercontent.com/reactive-tech/kubegres/v1.16/kubegres.yaml
2. create secret
3. deploy this yaml:

apiVersion: kubegres.reactive-tech.io/v1
kind: Kubegres
metadata:
  name: mypostgres
  namespace: default

spec:

   replicas: 3 
   image: postgres:latest

   database:
      size: 1000Mi

   env:
      - name: POSTGRES_PASSWORD
        valueFrom:
           secretKeyRef:
              name: mypostgres-secret
              key: superUserPassword

      - name: POSTGRES_REPLICATION_PASSWORD
        valueFrom:
           secretKeyRef:
              name: mypostgres-secret
              key: replicationUserPassword



5: results:

k8sadm@microk8s-nas:~$ kubectl get all -l 'app=mypostgres' --show-managed-fields -A -o wide

NAMESPACE   NAME                 READY   STATUS    RESTARTS   AGE   IP            NODE             NOMINATED NODE   READINESS GATES
default     pod/mypostgres-1-0   1/1     Running   0          88m   10.1.91.141   microk8s-nas     <none>           <none>
default     pod/mypostgres-2-0   1/1     Running   0          87m   10.1.69.16    microk8s-node2   <none>           <none>
default     pod/mypostgres-3-0   1/1     Running   0          86m   10.1.91.143   microk8s-nas     <none>           <none>

NAMESPACE   NAME                         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE   SELECTOR
default     service/mypostgres           ClusterIP   None         <none>        5432/TCP   88m   app=mypostgres,replicationRole=primary
default     service/mypostgres-replica   ClusterIP   None         <none>        5432/TCP   86m   app=mypostgres,replicationRole=replica

NAMESPACE   NAME                            READY   AGE   CONTAINERS     IMAGES
default     statefulset.apps/mypostgres-1   1/1     89m   mypostgres-1   postgres:latest
default     statefulset.apps/mypostgres-2   1/1     88m   mypostgres-2   postgres:latest
default     statefulset.apps/mypostgres-3   1/1     86m   mypostgres-3   postgres:latest

 dns tests:
k8sadm@microk8s-nas:~$ kubectl get svc -A -l "k8s-app=kube-dns" -o wide
NAMESPACE     NAME       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE     SELECTOR
kube-system   kube-dns   ClusterIP   10.152.183.10   <none>        53/UDP,53/TCP,9153/TCP   4h54m   k8s-app=kube-dns

k8sadm@microk8s-nas:~$ nslookup mypostgres.svc.cluster.local 10.152.183.10
Server:		10.152.183.10
Address:	10.152.183.10#53

** server can't find mypostgres.svc.cluster.local: NXDOMAIN


regards

@gaetanquentin
Copy link
Author

ok i read that it was by design.

but how can we use postgres outside the cluster? i want to connect to it with dbeaver for example?

regards.

@alazycoder101
Copy link

Add a ingress? or manually add another service as NodePort?
I think inthery you should be able to add your own service there should be any conflict between them.

@gaetanquentin
Copy link
Author

gaetanquentin commented Jan 4, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants