-
Notifications
You must be signed in to change notification settings - Fork 5k
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
docs: Instructions on make verify-kube-connect
step when using k3d
#4687
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,36 @@ make: *** [Makefile:386: verify-kube-connect] Error 1 | |
|
||
you should edit your `~/.kube/config` and modify the `server` option to point to your correct K8s API (as described above). | ||
|
||
### Using k3d | ||
|
||
k3d is a lightweight wrapper to run [k3s](https://github.com/rancher/k3s), a minimal Kubernetes distribution, in docker. Because it's running in a docker container, you're dealing with docker's internal networking rules when using k3d. A typical Kubernetes cluster running on your local machine is part of the same network that you're on so you can access it using **kubectl**. However, a Kubernetes cluster running within a docker container (in this case, the one launched by make) cannot access 0.0.0.0 from inside the container itself, when 0.0.0.0 is a network resource outside the container itself (and/or the container's network). This is the cost of a fully self-contained, disposable Kubernetes cluster. The following steps should help with a successful `make verify-kube-connect` execution. | ||
|
||
1. Find your host IP by executing `ifconfig` on Mac/Linux and `ipconfig` on Windows. For most users, the following command works to find the IP address. | ||
|
||
For Mac: | ||
``` | ||
IP=`ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}'` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will error out on linux and windows because the same interface device won't be available There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. on linux you can run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also keep in mind this IP will be dynamically assigned by the router so if your router restarts for any reason your IP will change and you will have to recreate the cluster. You can assign your PC a static IP to prevent that from happening There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review Amit. I added command for Linux. |
||
echo $IP | ||
``` | ||
|
||
For Linux: | ||
``` | ||
IP=`ifconfig eth0 | grep inet | grep -v inet6 | awk '{print $2}'` | ||
echo $IP | ||
``` | ||
|
||
Keep in mind that this IP is dynamically assigned by the router so if your router restarts for any reason, your IP might change. | ||
|
||
2. Edit your ~/.kube/config and replace 0.0.0.0 with the above IP address. | ||
|
||
3. Execute a `kubectl version` to make sure you can still connect to the Kubernetes API server via this new IP. Run `make verify-kube-connect` and check if it works. | ||
|
||
4. Finally, so that you don't have to keep updating your kube-config whenever you spin up a new k3d cluster, add `--api-port $IP:6550` to your **k3d cluster create** command, where $IP is the value from step 1. An example command is provided here. | ||
|
||
``` | ||
k3d cluster create my-cluster --wait --k3s-server-arg '--disable=traefik' --api-port $IP:6550 -p 443:443@loadbalancer | ||
``` | ||
|
||
## The development cycle | ||
|
||
When you have developed and possibly manually tested the code you want to contribute, you should ensure that everything will build correctly. Commit your changes to the local copy of your Git branch and perform the following steps: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the first point of [1] it has been mentioned that a minimal Kubernetes cluster k3s is enough for dev environment and from [2] i can see k3s is only supported on linux distribution. So on mac and windows we need a third party tool like k3d, VirtualBox etc which can provide a containerize/virtual linux env to install k3s.
Instead of specifying a tool to install k3s, IMO just create a hyper link k3d in the first point of [1] as one of containerize env provider and ofcourse for connectivity you need to provide ip address configuration information in k3d containerize env.
[1] https://github.com/argoproj/argo-cd/blob/master/docs/developer-guide/contributing.md#before-you-start
[2] https://rancher.com/docs/k3s/latest/en/installation/installation-requirements/#operating-systems