|
| 1 | +# Testing kube-router |
| 2 | + |
| 3 | +Our end-user testing goals are to: |
| 4 | +- Support easily running kube-router in any Kubernetes environment, new or |
| 5 | + existing. |
| 6 | +- Provide tools to quickly collect information about a cluster to help with |
| 7 | + troubleshooting kube-router issues. |
| 8 | + |
| 9 | +Our developer testing goals are to: |
| 10 | +- Provide tools to quickly build and test kube-router code and container images |
| 11 | +- Provide well-documented code testing protocols to ensure consistent code |
| 12 | + quality for all contributions. |
| 13 | +- Support quickly testing code changes by spinning up test clusters in local |
| 14 | + VMs, cloud environments, and via CI systems in pull requests. |
| 15 | +- Support running official Kubernetes e2e tests as well as custom e2e tests for |
| 16 | + kube-router's exclusive features. |
| 17 | + |
| 18 | +## End Users |
| 19 | + |
| 20 | +We currently support running kube-router on local VMs via Vagrant. Follow the |
| 21 | +instructions in [Starting A Local VM Cluster](#starting-a-local-vm-cluster) |
| 22 | +to get started. |
| 23 | + |
| 24 | +## Developers |
| 25 | + |
| 26 | +### Option 1: Local VM Cluster |
| 27 | + |
| 28 | +#### Starting A Local VM Cluster |
| 29 | + |
| 30 | +Running your code changes or simply trying out kube-router as-is in a real |
| 31 | +Kubernetes cluster is easy. Just make sure you have Virtualbox, VMware Fusion, |
| 32 | +or VMware Workstation installed and run: |
| 33 | +``` |
| 34 | +make vagrant-up-single-node |
| 35 | +``` |
| 36 | + |
| 37 | +Alternatively if you have 6GB RAM for the VMs, you can run a multi-node cluster |
| 38 | +that consists of a dedicated etcd node, a controller node, and a worker node: |
| 39 | +``` |
| 40 | +make vagrant-up-multi-node |
| 41 | +``` |
| 42 | + |
| 43 | +You will see lots of output as the VMs are provisioned, and the first run may |
| 44 | +take some time as VM and container images are downloaded. After the cluster is |
| 45 | +up you will recieve instructions for using kubectl and gaining ssh access: |
| 46 | +``` |
| 47 | + SUCCESS! The local cluster is ready. |
| 48 | +
|
| 49 | + ### kubectl usage ### |
| 50 | + # Quickstart - Use this kubeconfig for individual commands |
| 51 | + KUBECONFIG=/tmp/kr-vagrant-shortcut/cluster/auth/kubeconfig kubectl get pods --all-namespaces -o wide |
| 52 | + # |
| 53 | + ## OR ## |
| 54 | + # |
| 55 | + # Use this kubeconfig for the current terminal session |
| 56 | + KUBECONFIG=/tmp/kr-vagrant-shortcut/cluster/auth/kubeconfig |
| 57 | + export KUBECONFIG |
| 58 | + kubectl get pods --all-namespaces -o wide |
| 59 | + # |
| 60 | + ## OR ## |
| 61 | + # |
| 62 | + # Backup and replace your default kubeconfig |
| 63 | + # Note: This will continue to work on recreated local clusters |
| 64 | + mv ~/.kube/config ~/.kube/config-backup |
| 65 | + ln -s /tmp/kr-vagrant-shortcut/cluster/auth/kubeconfig ~/.kube/config |
| 66 | +
|
| 67 | + ### SSH ### |
| 68 | + # Get node names |
| 69 | + make vagrant status |
| 70 | + # SSH into a the controller node (c1) |
| 71 | + make vagrant ssh c1 |
| 72 | +``` |
| 73 | + |
| 74 | +#### Managing Your Local VM Cluster |
| 75 | + |
| 76 | +You can use [Vagrant](https://www.vagrantup.com/docs/cli/) commands against the |
| 77 | +running cluster with `make vagrant COMMANDS`. |
| 78 | + |
| 79 | +For example, `make vagrant status` outputs: |
| 80 | +``` |
| 81 | +Current machine states: |
| 82 | +
|
| 83 | +e1 not created (virtualbox) |
| 84 | +c1 not created (virtualbox) |
| 85 | +w1 not created (virtualbox) |
| 86 | +
|
| 87 | +This environment represents multiple VMs. The VMs are all listed |
| 88 | +above with their current state. For more information about a specific |
| 89 | +VM, run `vagrant status NAME`. |
| 90 | +``` |
| 91 | + |
| 92 | +With this information you can ssh into any of the VMs listed: |
| 93 | +``` |
| 94 | +make vagrant ssh c1 |
| 95 | +``` |
| 96 | + |
| 97 | +#### Upgrading kube-router In Your Local VM Cluster |
| 98 | + |
| 99 | +If you make code changes or checkout a different branch/tag, you can easily |
| 100 | +build, install, and run these changes in your previously started local VM |
| 101 | +cluster. |
| 102 | + |
| 103 | +`make vagrant-image-update` |
| 104 | + |
| 105 | +Unlike `make vagrant-up-*` targets, this does not destroy and recreate the VMs, |
| 106 | +and instead does the updates live. This will save time if you aren't concerned |
| 107 | +about having a pristine OS/Kubernetes environment to test against. |
0 commit comments