2016-09-13 00:01:02 +00:00
---
assignees:
- Random-Liu
2016-12-15 20:16:54 +00:00
title: Validate Node Setup
2016-09-13 00:01:02 +00:00
---
* TOC
{:toc}
## Node Conformance Test
2016-12-02 03:00:07 +00:00
*Node conformance test* is a containerized test framework that provides a system
verification and functionality test for a node. The test validates whether the
node meets the minimum requirements for Kubernetes; a node that passes the test
is qualified to join a Kubernetes cluster.
2016-09-13 00:01:02 +00:00
## Limitations
2016-12-02 03:00:07 +00:00
In Kubernetes version 1.5, node conformance test has the following limitations:
2016-09-13 00:01:02 +00:00
* Node conformance test only supports Docker as the container runtime.
2016-12-02 03:00:07 +00:00
## Node Prerequisite
2016-09-13 00:01:02 +00:00
2016-12-02 03:00:07 +00:00
To run node conformance test, a node must satisfy the same prerequisites as a
standard Kubernetes node. At a minimum, the node should have the following
daemons installed:
2016-09-13 00:01:02 +00:00
* Container Runtime (Docker)
* Kubelet
2016-12-02 03:00:07 +00:00
## Running Node Conformance Test
2016-09-13 00:01:02 +00:00
2016-12-02 03:00:07 +00:00
To run the node conformance test, perform the following steps:
2016-09-13 00:01:02 +00:00
2016-12-02 03:00:07 +00:00
1. Point your Kubelet to localhost `--api-servers="http://localhost:8080"` ,
2016-11-24 00:32:20 +00:00
because the test framework starts a local master to test Kubelet. There are some
other Kubelet flags you may care:
* `--pod-cidr` : If you are using `kubenet` , you should specify an arbitrary CIDR
to Kubelet, for example `--pod-cidr=10.180.0.0/24` .
* `--cloud-provider` : If you are using `--cloud-provider=gce` , you should
remove the flag to run the test.
2016-09-13 00:01:02 +00:00
2016-12-02 03:00:07 +00:00
2. Run the node conformance test with command:
2016-09-13 00:01:02 +00:00
```shell
2016-11-24 00:32:20 +00:00
# $CONFIG_DIR is the pod manifest path of your Kubelet.
2016-09-13 00:01:02 +00:00
# $LOG_DIR is the test output path.
sudo docker run -it --rm --privileged --net=host \
2016-11-24 00:32:20 +00:00
-v /:/rootfs -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \
gcr.io/google_containers/node-test:0.2
2016-09-13 00:01:02 +00:00
```
2016-12-02 03:00:07 +00:00
## Running Node Conformance Test for Other Architectures
2016-09-13 00:01:02 +00:00
2016-12-02 03:00:07 +00:00
Kubernetes also provides node conformance test docker images for other
architectures:
2016-09-13 00:01:02 +00:00
Arch | Image |
--------|:-----------------:|
amd64 | node-test-amd64 |
arm | node-test-arm |
arm64 | node-test-arm64 |
2016-12-02 03:00:07 +00:00
## Running Selected Test
2016-09-13 00:01:02 +00:00
To run specific tests, overwrite the environment variable `FOCUS` with the
regular expression of tests you want to run.
```shell
sudo docker run -it --rm --privileged --net=host \
2016-11-24 00:32:20 +00:00
-v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \
2016-09-13 00:01:02 +00:00
-e FOCUS=MirrorPod \ # Only run MirrorPod test
2016-11-24 00:32:20 +00:00
gcr.io/google_containers/node-test:0.2
2016-09-13 00:01:02 +00:00
```
To skip specific tests, overwrite the environment variable `SKIP` with the
regular expression of tests you want to skip.
```shell
sudo docker run -it --rm --privileged --net=host \
2016-11-24 00:32:20 +00:00
-v /:/rootfs:ro -v $CONFIG_DIR:$CONFIG_DIR -v $LOG_DIR:/var/result \
-e SKIP=MirrorPod \ # Run all conformance tests but skip MirrorPod test
gcr.io/google_containers/node-test:0.2
2016-09-13 00:01:02 +00:00
```
2017-01-18 00:13:42 +00:00
Node conformance test is a containerized version of [node e2e test ](https://github.com/kubernetes/kubernetes/blob/{{page.version}}/docs/devel/e2e-node-tests.md ).
2016-11-24 00:32:20 +00:00
By default, it runs all conformance tests.
Theoretically, you can run any node e2e test if you configure the container and
mount required volumes properly. But **it is strongly recommended to only run conformance
test**, because it requires much more complex configuration to run non-conformance test.
2016-12-02 03:00:07 +00:00
## Caveats
2016-09-13 00:01:02 +00:00
2016-11-24 00:32:20 +00:00
* The test leaves some docker images on the node, including the node conformance
test image and images of containers used in the functionality
2016-09-13 00:01:02 +00:00
test.
2016-12-02 03:00:07 +00:00
* The test leaves dead containers on the node. These containers are created
2016-09-13 00:01:02 +00:00
during the functionality test.