API connection refused on https pod kubernetes

Viewed 25

I've deployed an Wazuh API on my kubernetes cluster and I cannot reach the 55000 port outside the pod , it says "curl: (7) Failed to connect to wazuh-master port 55000: Connection refused"

NAME                      READY   STATUS    RESTARTS   AGE     IP             NODE        NOMINATED NODE   READINESS GATES
wazuh-manager-worker-0    1/1     Running   0          4m47s   172.16.0.231   10.0.0.10   <none>           <none>
wazuh-master-0            1/1     Running   0          4m47s   172.16.0.230   10.0.0.10   <none>           <none>

NAME            TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                         AGE
wazuh-cluster   ClusterIP      None            <none>        1516/TCP                        53s
wazuh-master    ClusterIP      10.247.82.29    <none>        1515/TCP,55000/TCP              53s
wazuh-workers   LoadBalancer   10.247.70.29    <pending>     1514:32371/TCP                  53s

I've couple of curl test scenarious:

1. curl the name of the pod "wazuh-master-0" - Could not resolve host: wazuh-master-0

curl -u user:pass -k -X GET "https://wazuh-master-0:55000/security/user/authenticate?raw=true"
curl: (6) Could not resolve host: wazuh-master-0

2. curl the name of the service of the pod "wazuh-master" - Failed to connect to wazuh-master port 55000: Connection refused

curl -u user:pass -k -X GET "https://wazuh-master:55000/security/user/authenticate?raw=true"
curl: (7) Failed to connect to wazuh-master port 55000: Connection refused

3. curl the ip of the pod "wazuh-master-0 172.16.0.230" - successfull

curl -u user:pass -k -X GET "https://172.16.0.230:55000/security/user/authenticate?raw=true"
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUasfsdfgfhgsdoIEFQSSBSRVhgfhfghfghgfasasdasNUIiwibmJmIjoxNjYzMTQ3ODcxLCJleHAiOjE2NjMxNDg3NzEsInN1YiI6IndhenV

wazuh-master-svc.yaml

apiVersion: v1
kind: Service
metadata:
  name: wazuh-master
  labels:
    app: wazuh-manager
spec:
  type: ClusterIP
  selector:
    app: wazuh-manager
    node-type: LoadBalancer
  ports:
    - name: registration
      port: 1515
      targetPort: 1515
    - name: api
      port: 55000
      targetPort: 55000

What i'm doing wrong ?

1 Answers

I've fixed it, i've removed the line below from the spec: selector: node-type

node-type: LoadBalancer
Related