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

Support kind for development environment #7582

Closed
shu-mutou opened this issue Jan 8, 2023 · 13 comments
Closed

Support kind for development environment #7582

shu-mutou opened this issue Jan 8, 2023 · 13 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@shu-mutou
Copy link
Contributor

What would you like to be added?

kind cluster for dashboard that is ran with docker compose.

Why is this needed?

To check easily dashboard when user try or develop.

@shu-mutou shu-mutou added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 8, 2023
@shu-mutou
Copy link
Contributor Author

I'm investigating for this. Write down what I have researched.

  1. The most important thing seems to be how to create docker network fot this.
    We can use KIND_EXPERIMENTAL_DOCKER_NETWORK environment variable to specify docker network for kind. It's experimental option, but it seems to work properly. Then, run dashboard with docker-compose.yml that network.default.name was specifed as same docker network.
  2. When we set $KUBECONFIG for running dashboard with make run on the development container, also to run kind on development container, we need to specify path to kubeconfig inside development container like kind --kubeconifg=/home/user/.kube/config. Because kind make kubeconfig file at $KUBECONFIG
  3. Docker container for kind allows acceses from local like 127.0.0.1. To access apiserver on the kind container from dashboard, we need to set this like 0.0.0.0. Then run kind create cluster. After kind start, we need to modify server directive on kubeconfig that was created by kind. The value of server was set as 0.0.0.0, so it should be changed as actual ip address on the docker network, e.g. 172.24.0.3.

@shu-mutou
Copy link
Contributor Author

If we prevent to use the experimental option of kind, the only way is to join the dashboard container to this docker network named as kind. I'd like to continue to investigate the former way that use KIND_EXPERIMENTAL_DOCKER_NETWORK.

@shu-mutou
Copy link
Contributor Author

Now that I have connected the dashboard launched by make run to the kind cluster, I will try to implement it so that it can be executed by script.

user@f625f1a356bb:/go/src/github.com/kubernetes/dashboard$ docker ps
CONTAINER ID   IMAGE                                 COMMAND                  CREATED             STATUS             PORTS                                                                                                                    NAMES
979ca13af372   dashboard-gateway                     "/docker-entrypoint.…"   7 minutes ago       Up 7 minutes       80/tcp, 0.0.0.0:4443->4443/tcp, :::4443->4443/tcp                                                                        dashboard-gateway-1
d7d4cf979c84   dashboard-web                         "/dashboard-web --in…"   7 minutes ago       Up 7 minutes       8000-8001/tcp                                                                                                            dashboard-web-1
88fdeef2e7b1   dashboard-api                         "/dashboard-api --in…"   7 minutes ago       Up 7 minutes       9000/tcp, 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp                                                                      dashboard-api-1
f95493924d81   kubernetesui/metrics-scraper:v1.0.8   "/metrics-sidecar --…"   7 minutes ago       Up 7 minutes       8080/tcp                                                                                                                 dashboard-scraper-1
f3b72588c0c3   kindest/node:v1.25.3                  "/usr/local/bin/entr…"   About an hour ago   Up About an hour   0.0.0.0:6443->6443/tcp                                                                                                   kd-kind-control-plane
f625f1a356bb   k8s-dashboard-dev                     "/bin/sh -c ./hack/d…"   About an hour ago   Up About an hour   8080/tcp, 8443/tcp, 0.0.0.0:2345->2345/tcp, :::2345->2345/tcp, 0.0.0.0:20443->20443/tcp, :::20443->20443/tcp, 9090/tcp   k8s-dashboard-dev
user@f625f1a356bb:/go/src/github.com/kubernetes/dashboard$ docker inspect kdnet
[
    {
        "Name": "kdnet",
        "Id": "4aece2d03b5bdd98396091776ec3544d724855d683b1aa5bc81509cff26fbb2d",
        "Created": "2023-01-08T18:36:27.559718673+09:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.24.0.0/16",
                    "Gateway": "172.24.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "88fdeef2e7b1ca97468909a934caa3345d70d4d6144c0e42e02e385b71fba44e": {
                "Name": "dashboard-api-1",
                "EndpointID": "fca63aeac65d66b2f668dd139c395cddd628cc219f5e208dbe98cd7006365c18",
                "MacAddress": "02:42:ac:18:00:07",
                "IPv4Address": "172.24.0.7/16",
                "IPv6Address": ""
            },
            "979ca13af372ea4644ed1a7b39d6ae69a56ba97a4a675340a83328529347eef0": {
                "Name": "dashboard-gateway-1",
                "EndpointID": "3059286b1abda4b5c969a04d15698be5d13caef3e03be607f2051c9c308f72e3",
                "MacAddress": "02:42:ac:18:00:05",
                "IPv4Address": "172.24.0.5/16",
                "IPv6Address": ""
            },
            "d7d4cf979c840c91f2c56b7a84b2513ce9ed148bebd679ca68e47990deb81ae4": {
                "Name": "dashboard-web-1",
                "EndpointID": "969eb55901bd5c70a6dad7670918e9e0f8f0cd91959a3789917b4656241cbdf4",
                "MacAddress": "02:42:ac:18:00:06",
                "IPv4Address": "172.24.0.6/16",
                "IPv6Address": ""
            },
            "f3b72588c0c3df5cd4ffe8a64c14d853faec62fc23681d0673cfbd4a11eaabed": {
                "Name": "kd-kind-control-plane",
                "EndpointID": "23f36cb5f555a905b3ac04397201100e7506b15bd016250c163a5215fae73ea4",
                "MacAddress": "02:42:ac:18:00:03",
                "IPv4Address": "172.24.0.3/16",
                "IPv6Address": ""
            },
            "f625f1a356bb8c93136ff1e6ef25c5615cbf353a95c4b4a6c32078ea16c3c6dd": {
                "Name": "k8s-dashboard-dev",
                "EndpointID": "d8c29605fb329c0367e87dabd3c5cf23c15ca44c50dbb79d6f5c8dc456240234",
                "MacAddress": "02:42:ac:18:00:02",
                "IPv4Address": "172.24.0.2/16",
                "IPv6Address": ""
            },
            "f95493924d81a21f93074f911f084127d591d383fe28b80fdf828b4a01c5cfc0": {
                "Name": "dashboard-scraper-1",
                "EndpointID": "0a5f4c5839508668754d7b03fea0a717f2ae15728605a13c319e14697df7762d",
                "MacAddress": "02:42:ac:18:00:04",
                "IPv4Address": "172.24.0.4/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]

image

@shu-mutou
Copy link
Contributor Author

/assign

@shu-mutou
Copy link
Contributor Author

@maciaszczykm @floreks
What do you think about using KIND_EXPERIMENTAL_DOCKER_NETWORK?

@floreks
Copy link
Member

floreks commented Jan 11, 2023

I'd use a way that will not require updating the current setup too much. We can allow overriding the docker-compose network name through the env variable when using make run or make serve. Other than that I'd leave it up to the user to decide how to make it work. We can add some description to the dev docs explaining how to use kind.

@shu-mutou
Copy link
Contributor Author

Thank you for your comment!
I’d like to write down each method into our documentation for developer.

Also, I'd like to implement this results into development container for myself. 😄

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 18, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 18, 2023
@maciaszczykm maciaszczykm added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels May 18, 2023
@luchillo17
Copy link

Not sure I understand this, are you running the dashboard outside the cluster?

@maciaszczykm
Copy link
Member

It's already done. Check out Makefile.

@maciaszczykm
Copy link
Member

@shu-mutou can we delete development image then?

@shu-mutou
Copy link
Contributor Author

@maciaszczykm I want to keep development container to run checks and tests in local machine.
PTAL #8828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

6 participants