Search code examples
dockerkubernetesdocker-composeminikubekompose

Error while deploying application: Get http://localhost:8080/api: dial tcp [::1]:8080: connectex:


How do you set up environment variable for config. Could some one please explain in details. I am using windows home and trying to docker-compose.yml to k8s but when I do kompose up it says: I have installed kubectl and minikube and dont know how to set the config file so this api can be started

Error while deploying application: Get http://localhost:8080/api: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

Thanks by advance


Solution

  • Kompose always refer to http://localhost:8080/ by default. The problem is that as you are using minikube, your api server is in a different address.

    To check the address of your API, run any kubectl command and get your API server address:

    $ kubectl get nodes -v6
    

    Output:

    I0518 07:27:05.109476    3656 loader.go:375] Config loaded from file:  /home/christofoletti/.kube/config
    I0518 07:27:05.138651    3656 round_trippers.go:443] GET https://192.168.39.6:8443/api/v1/nodes?limit=500 200 OK in 19 milliseconds
    NAME       STATUS   ROLES    AGE     VERSION
    cluster2   Ready    master   3d19h   v1.18.2
    

    As you can see, we have GET https://192.168.39.36:8443/api/v1/nodes?limit=500 200 OK.

    So, my API server address is https://192.168.39.26:8443/.

    Now you can run $ kompose up --server https://192.168.39.26:8443/ and Kompose will know where to send the request.