sogno-platform / clonemap

cloud-native Multi-Agent Platform
Other
3 stars 0 forks source link

ImagePullErr when trying to run agentlib MAS with k8s #9

Closed kwe712 closed 7 months ago

kwe712 commented 2 years ago

Starting an agentlib MAS works fine with the docker-compose version, but (for me) fails with kubernetes.

    "config":{
        "name":"test",
        "agentsperagency":1,
        "mqtt":{
            "active":true
        },
        "df":{
            "active":false
        },
        "logger":{
            "active":true,
            "msg":true,
            "app":true,
            "status":true,
            "debug":true
        }
    },
    "imagegroups":[
        {
            "config": {
                "image":"agentlibtest"
            },
            "agents":[...]
        }
    ],
    "graph":{
        "node":null,
        "edge":null
    }
}

running the same example with docker-compose, the image gets pulled from registry.git-ce.rwth-aachen.de/ebc/projects/ebc_acs0017_bmwi_agent/agents_python/agentlib:latest just fine. With kubernetes, it results in an ErrImagePull, even if the image is already locally pulled and regardless of whether image-pull-policy is set to "Never" or "Always".

s-daehling commented 2 years ago

I guess that you are using minikube and try to reuse the same image that is present on the host. Correct? This is not possible right away. There is a separate in-cluster docker-daemon that is different from the one on the host. However, you can directly access the cluster docker-daemon from your host by using the following command

eval $(minikube docker-env)

See also here: https://minikube.sigs.k8s.io/docs/handbook/pushing/

If you want to pull an image from a private registry (such as the agentlib gitlab) you have to create a PullSecret. Within your Gitlab project create a deploy token (Settings->Repository->Deploy tokens, scope: read_registry). With the username and token you can now create the PullSecret using following command:

kubectl create secret docker-registry <secret-name> --docker-server=<gitlab-registry-address> --docker-username=<username> --docker-password=<token>

You might also have to specify the namespace if cloneMAP is not started in the default namespace.

To let cloneMAP know the secret, you have to specify it in the yaml file you use for MAS deployment.

imagegroups":[
        {
            "config": {
                "image":"agentlibtest",
                "secret": **<secret-name>**
            },
            "agents":[...]
        }
    ],

Please let me know if this solves your issue.

kwe712 commented 1 year ago

Thank you! I'm still working on this, not using Minikube but Rancher Desktop (with WSL2). Unfortunately so far the secret didn't work, I am now looking into ways to manage images from a private registry with rancher (similar to minikube cache).

I tried to use Minikube in the beginning, but I get a connection refused error every time I try to curl POST to the cluster's IP. Are there additional steps necessary to expose the clonemap API when using Minikube?