mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-15 17:28:58 +03:00
Update to latest version (#325)
* Build now functional * Use ssh option to reduce questions * Use IPVS * Further e2e observations * Tidy up * RAM and CPU adjustments
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
# Run End-to-End Tests
|
||||
|
||||
Observations by Alistair (KodeKloud):
|
||||
|
||||
Depending on your computer, you may have varying success with these. I have found them to run much more smoothly on a 12 core Intel(R) Core(TM) i7-7800X Desktop Processor (circa 2017), than on a 20 core Intel(R) Core(TM) i7-12700H Laptop processor (circa 2022) - both machines having 32GB RAM and both machines running the same version of VirtualBox. On the latter, it tends to destabilize the cluster resulting in timeouts in the tests. This *may* be a processor issue in that laptop processors are not really designed to take the kind of abuse that'll be thrown by the tests at a kube cluster that really should be run on a Server processor. Laptop processors do odd things for power conservation like constantly varying the clock speed and mixing "performance" and "efficiency" cores, even when the laptop is plugged in, and this could be causing synchronization issues with the goroutines running in the kube components. If anyone has a definitive explanation for this, please do post in the kubernetes-the-hard-way Slack channel.
|
||||
|
||||
|
||||
## Install latest Go
|
||||
|
||||
```bash
|
||||
@@ -7,35 +12,55 @@ GO_VERSION=$(curl -s 'https://go.dev/VERSION?m=text' | head -1)
|
||||
wget "https://dl.google.com/go/${GO_VERSION}.linux-amd64.tar.gz"
|
||||
|
||||
sudo tar -C /usr/local -xzf ${GO_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
|
||||
sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
||||
|
||||
source <(go env)
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
```
|
||||
|
||||
## Install kubetest
|
||||
## Install kubetest2
|
||||
|
||||
Here we pull the kubetest2 code, and the Google Cloud CLI which kubetest uses to pull the test packages for our version of the cluster. Kubetest will download and then compile, which takes a few minutes.
|
||||
|
||||
|
||||
```bash
|
||||
git clone --depth 1 https://github.com/kubernetes/test-infra.git
|
||||
cd test-infra/kubetest
|
||||
export GOPATH="$HOME/go"
|
||||
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
|
||||
go build
|
||||
go install sigs.k8s.io/kubetest2/...@latest
|
||||
sudo snap install google-cloud-cli --classic
|
||||
```
|
||||
|
||||
> Note: it will take a while to build as it has many dependencies.
|
||||
## Run test
|
||||
|
||||
Here we set up a couple of environment variables to supply arguments to the test package - the version of our cluster and the number of CPUs on `master-1` to aid with test parallelization.
|
||||
|
||||
## Use the version specific to your cluster
|
||||
Then we invoke the test package
|
||||
|
||||
```bash
|
||||
sudo apt install jq -y
|
||||
KUBE_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
|
||||
NUM_CPU=$(cat /proc/cpuinfo | grep '^processor' | wc -l)
|
||||
|
||||
cd ~
|
||||
kubetest2 noop --kubeconfig ${PWD}/.kube/config --test=ginkgo -- \
|
||||
--focus-regex='\[Conformance\]' --test-package-version $KUBE_VERSION --logtostderr --parallel $NUM_CPU
|
||||
```
|
||||
|
||||
```bash
|
||||
K8S_VERSION=$(kubectl version -o json | jq -r '.serverVersion.gitVersion')
|
||||
export KUBERNETES_CONFORMANCE_TEST=y
|
||||
export KUBECONFIG="$HOME/.kube/config"
|
||||
While this is running, you can open an additional session on `master-1` from your workstation and watch the activity in the cluster
|
||||
|
||||
./kubetest --provider=skeleton --test --test_args=”--ginkgo.focus=\[Conformance\]” --extract ${K8S_VERSION} | tee test.out
|
||||
```
|
||||
vagrant ssh master-1
|
||||
```
|
||||
|
||||
This could take *18 hours or more*! There are several thousand tests in the suite. The number of tests run and passed will be displayed at the end. Expect some failures as it tries tests that aren't supported by our cluster, e.g. mounting persistent volumes using NFS.
|
||||
then
|
||||
|
||||
```
|
||||
watch kubectl get all -A
|
||||
```
|
||||
|
||||
Observations by Alistair (KodeKloud):
|
||||
|
||||
This should take up to an hour to run. The number of tests run and passed will be displayed at the end. Expect some failures!
|
||||
|
||||
I am not able to say exactly why the failed tests fail. It would take days to go though the truly enormous test code base to determine why the tests that fail do so.
|
||||
|
||||
Prev: [Smoke Test](16-smoke-test.md)
|
||||
Reference in New Issue
Block a user