-
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
Conversation
make verify-kube-connect
step when using k3d to spin-up Kubernetes clustermake verify-kube-connect
step when using k3d to spin-up Kubernetes cluster
Shorten title of the PR, and have a longer description mentioning what led you to go down this path :-) |
docs/developer-guide/contributing.md
Outdated
@@ -156,6 +156,29 @@ 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). | |||
|
|||
### If using k3d to spin-up your Kubernetes cluster |
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.
You could have the title as "Using k3d".
docs/developer-guide/contributing.md
Outdated
@@ -156,6 +156,29 @@ 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). | |||
|
|||
### If using k3d to spin-up your Kubernetes cluster | |||
|
|||
Because it's running in a docker container, you're dealing with docker's internal networking rules when using k3d. This is the cost of a fully self-contained, disposable k8s cluster. The following steps should help with a successful `make verify-kube-connect` execution. |
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.
Introduce k3d, provide some details about how it different than a usual kubernetes cluster - and the subsequent issues.
:)
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.
thanks for the note @sbose78 :)
Added an intro for k3d and some comparison with traditional k8s cluster on local machine.
Codecov Report
@@ Coverage Diff @@
## master #4687 +/- ##
==========================================
- Coverage 41.37% 41.00% -0.37%
==========================================
Files 126 127 +1
Lines 17154 17367 +213
==========================================
+ Hits 7097 7122 +25
- Misses 9042 9223 +181
- Partials 1015 1022 +7
Continue to review full report at Codecov.
|
Thanks for the note @sbose78. Shortened the PR and tried to provide some context in the description. |
make verify-kube-connect
step when using k3d to spin-up Kubernetes clustermake verify-kube-connect
step when using k3d
@@ -156,6 +156,29 @@ 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. |
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
1. Find the actual external IP of your host. You can do so by executing `ifconfig` on Mac/Linux and `ipconfig` on Windows. For most users, the following command works to find the IP address. | ||
|
||
``` | ||
IP=`ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}'` |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
on linux you can run ip addr
. I don't know about windows.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review Amit. I added command for Linux.
docs/developer-guide/contributing.md
Outdated
|
||
3. Execute a `kubectl version` to make sure you can still connect to the Kubernetes API server via this new IP. If not, go back to step 1. | ||
|
||
4. Run `make verify-kube-connect` and check if it works. |
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.
This validation has been covered as part of - https://github.com/argoproj/argo-cd/blob/master/docs/developer-guide/contributing.md#test-connection-from-build-container-to-your-k8s-cluster
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.
Thanks for the review Amit. I merged these two points as a single step. I tried removing both steps and then the procedure seemed incomplete to me. Therefore, I traded a single instance of repeat for clarity.
docs/developer-guide/contributing.md
Outdated
|
||
4. Run `make verify-kube-connect` and check if it works. | ||
|
||
5. 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. |
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.
IMO theis should be part of the k3d documentation.
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.
I checked existing k3d doc and they don't seem to have this explanation.
Server timeout /retest |
/test all |
Hi @sbose78 pls let me know if I can make any other improvement on this PR. |
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.
LGTM. Thank you!
…zation-generators * 'master' of github.com:argoproj/argo-cd: fix: RevisionFormField component crashes in 'refs' API returns no tags (argoproj#4735) docs: add Opensurvey to USERS.md (argoproj#4727) docs: correct parameters usage in CLI (argoproj#4725) fix: Repo-server has silent unmarshalling errors leading to empty applications (argoproj#4423) (argoproj#4708) fix: inject artificial delay between sync waves to better support health assessments (argoproj#4715) fix: exclude files listed under exclusions (argoproj#4686) feat: support resource actions on CRDs that use status subresources (argoproj#4690) feat: Add autocomplete for repo Revisions (argoproj#4645) (argoproj#4713) fix: webhook don't refresh apps pointing to HEAD (argoproj#4717) feat: Add support for ExecProvider cluster auth (argoproj#4600) (argoproj#4710) fix: adding helm values file in New App (argoproj#4635) docs: Instructions on `make verify-kube-connect` step when using k3d (argoproj#4687) feat: Annotation based app paths detection in webhooks (argoproj#4699) fix: adding commonAnnotations for Kustomize (argoproj#4613)
When setting up my local development environment following the developer guide, I got stuck at testing the connection from build container to my Kubernetes cluster which is a k3s cluster using k3d. After posting the question on argocd slack, I was pointed to this discussion where someone else faced the same challenge. Being the second person to get stuck on this issue, I would not want a third person to get stuck and hence proposing this doc update. This PR will provide step-by-step guidance to someone using k3d to execute a successful
make verify-kube-connect
.Checklist: