hyperhq / runv

Hypervisor-based Runtime for OCI
Apache License 2.0
828 stars 129 forks source link

Test runv failed in swarm mode #582

Closed jovizhangwei closed 7 years ago

jovizhangwei commented 7 years ago

I've tested runv in swarm mode, failed with below logs:

$sudo docker service create --name nginx -p 8080:80 nginx

$sudo docker service logs nginx
nginx.1.jvu6senhvj68@buffer010101170038.et2sqa    | E0828 16:55:30.287532   31315 network.go:153] cann't find nic whose ifindex is 9210
nginx.1.jvu6senhvj68@buffer010101170038.et2sqa    | E0828 16:55:30.288391   31315 network.go:153] cann't find nic whose ifindex is 9210

Instead of swarm mode, nginx could started normally by "docker run".

$sudo docker run -it --rm -p 8081:80 nginx bash
root@702b784a1666:/# nginx
root@702b784a1666:/# 

In contrary, Clear Container runs smoothly in swarm mode.

gao-feng commented 7 years ago

Hi jovi,

Can you checkout if this pr fix this problem? https://github.com/hyperhq/runv/pull/592

Thanks!

jovizhangwei commented 7 years ago

Thanks for your work @gao-feng , does that PR already supports below commands?

docker service create --name nginx -p 8080:80 nginx
docker network create --driver overlay overlay-net
docker service create --name nginx --network overlay-net -p 8080:80 nginx

And it would be kind if a compiled binary or release are provided for test.

gao-feng commented 7 years ago

@jovizhangwei

Yes, with my test, these commands works well, but FYI, runv doesn't support DNS server in user-defined networks now https://github.com/hyperhq/runv/issues/363

Please try this binary https://drive.google.com/file/d/0B80uoYKIfW5NajE2U2hlLVc2QkE/view?usp=sharing md5sum is 66d6db1233e297ec6bbf2db2f704ce64

Thanks

jovizhangwei commented 7 years ago

@gao-feng @laijs I can ran below command:

$sudo docker service create --name nginx -p 8080:80 nginx:alpine
xbh2i3cs23ntwsnnyq7fuugvb
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.

But I cannot access the nginx service from outside, I can confirm the nginx already received the request, but some issues happened when sent the request out.

Everything is fine if I start the container not in swarm mode.

$sudo docker run -it --rm -p 8080:80 nginx:alpine sh
/ # nginx 
gao-feng commented 7 years ago

@jovizhangwei

test nginx:alpine image on swarm mode, it works well, I can access nginx Welcome page on 172.18.0.x address, did you use ping to test if the network is available?

jovizhangwei commented 7 years ago

@gao-feng Still not working, same error as last post.

The network is available, and the nginx can be accessed from outside if started by "docker run", but can not access if started by "docker service create", both use runv as runtime.

Run command both in runv and Clear Container:

$sudo docker service create --name nginx1 --constraint node.role==manager -p 8081:80 nginx

docker service inspect based on runv:

$sudo docker service inspect nginx1
[
    {
        "ID": "tx6yvia5951yjkodg97ejb7m8",
        "Version": {
            "Index": 79136
        },
        "CreatedAt": "2017-09-20T06:43:27.844985651Z",
        "UpdatedAt": "2017-09-20T06:43:27.890019064Z",
        "Spec": {
            "Name": "nginx1",
            "Labels": {},
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "nginx:latest@sha256:aa1c5b5f864508ef5ad472c45c8d3b6ba34e5c0fb34aaea24acf4b0cee33187e",
                    "StopGracePeriod": 10000000000,
                    "DNSConfig": {}
                },
                "Resources": {
                    "Limits": {},
                    "Reservations": {}
                },
                "RestartPolicy": {
                    "Condition": "any",
                    "Delay": 5000000000,
                    "MaxAttempts": 0
                },
                "Placement": {
                    "Constraints": [
                        "node.role==manager"
                    ],
                    "Platforms": [
                        {
                            "Architecture": "amd64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "arm",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "arm64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "386",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "ppc64le",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "s390x",
                            "OS": "linux"
                        }
                    ]
                },
                "ForceUpdate": 0,
                "Runtime": "container"
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 1
                }
            },
            "UpdateConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "RollbackConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "EndpointSpec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 80,
                        "PublishedPort": 8081,
                        "PublishMode": "ingress"
                    }
                ]
            }
        },
        "Endpoint": {
            "Spec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 80,
                        "PublishedPort": 8081,
                        "PublishMode": "ingress"
                    }
                ]
            },
            "Ports": [
                {
                    "Protocol": "tcp",
                    "TargetPort": 80,
                    "PublishedPort": 8081,
                    "PublishMode": "ingress"
                }
            ],
            "VirtualIPs": [
                {
                    "NetworkID": "wmfihqdtk90lcm1gxna51ql12",
                    "Addr": "10.255.0.2/16"
                }
            ]
        }
    }
]

docker service inspect based on Clear Container:

$sudo docker service inspect oc19lax3r6ne
[
    {
        "ID": "oc19lax3r6nehqjwc3fu71dcu",
        "Version": {
            "Index": 79154
        },
        "CreatedAt": "2017-09-20T07:18:38.648547947Z",
        "UpdatedAt": "2017-09-20T07:19:23.321722328Z",
        "Spec": {
            "Name": "nginx1",
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "nginx:latest@sha256:aa1c5b5f864508ef5ad472c45c8d3b6ba34e5c0fb34aaea24acf4b0cee33187e",
                    "DNSConfig": {}
                },
                "Resources": {
                    "Limits": {},
                    "Reservations": {}
                },
                "RestartPolicy": {
                    "Condition": "any",
                    "MaxAttempts": 0
                },
                "Placement": {
                    "Constraints": [
                        "node.role==manager"
                    ]
                },
                "ForceUpdate": 0
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 1
                }
            },
            "UpdateConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "MaxFailureRatio": 0
            },
            "EndpointSpec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 80,
                        "PublishedPort": 8081,
                        "PublishMode": "ingress"
                    }
                ]
            }
        },
        "Endpoint": {
            "Spec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 80,
                        "PublishedPort": 8081,
                        "PublishMode": "ingress"
                    }
                ]
            },
            "Ports": [
                {
                    "Protocol": "tcp",
                    "TargetPort": 80,
                    "PublishedPort": 8081,
                    "PublishMode": "ingress"
                }
            ],
            "VirtualIPs": [
                {
                    "NetworkID": "wmfihqdtk90lcm1gxna51ql12",
                    "Addr": "10.255.0.2/16"
                }
            ]
        },
        "UpdateStatus": {
            "StartedAt": "0001-01-01T00:00:00Z",
            "CompletedAt": "0001-01-01T00:00:00Z"
        }
    }
]