Change:
### Create POD valid-pod from JSON # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command <del> kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" </del> <ins> kubectl create "${kube_flags[@]}" -f examples/limitrange/valid-pod.json </ins> # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' kube::test::get_object_assert 'pod valid-pod' '{{.id}}' 'valid-pod' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' kube::test::get_object_assert 'pod valid-pod' "{{.$id_field}}" 'valid-pod' </ins> ### Dump current valid-pod POD output_pod=$(kubectl get pod valid-pod -o yaml --output-version=v1beta1 "${kube_flags[@]}") ### Delete POD valid-pod by id # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command kubectl delete pod valid-pod "${kube_flags[@]}" # Post-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create POD valid-pod from dumped YAML # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command echo "${output_pod}" | kubectl create -f - "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Delete POD valid-pod from JSON # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command kubectl delete -f examples/limitrange/valid-pod.json "${kube_flags[@]}" # Post-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create POD redis-master from JSON # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Delete POD valid-pod with label # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert 'pods -l name=valid-pod' '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert 'pods -l name=valid-pod' "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command kubectl delete pods -l name=valid-pod "${kube_flags[@]}" # Post-condition: no POD is running <del> kube::test::get_object_assert 'pods -l name=valid-pod' '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert 'pods -l name=valid-pod' "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create POD valid-pod from JSON # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Delete PODs with no parameter mustn't kill everything # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command ! kubectl delete pods "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Delete PODs with --all and a label selector is not permitted # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command ! kubectl delete --all pods -l name=valid-pod "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Delete all PODs # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command kubectl delete --all pods "${kube_flags[@]}" # --all remove all the pods # Post-condition: no POD is running <del> kube::test::get_object_assert 'pods -l name=valid-pod' '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert 'pods -l name=valid-pod' "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create two PODs # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" kubectl create -f examples/redis/redis-proxy.yaml "${kube_flags[@]}" # Post-condition: valid-pod and redis-proxy PODs are running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'redis-proxy:valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'redis-proxy:valid-pod:' </ins> ### Delete multiple PODs at once # Pre-condition: valid-pod and redis-proxy PODs are running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'redis-proxy:valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'redis-proxy:valid-pod:' </ins> # Command kubectl delete pods valid-pod redis-proxy "${kube_flags[@]}" # delete multiple pods at once # Post-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create two PODs # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" kubectl create -f examples/redis/redis-proxy.yaml "${kube_flags[@]}" # Post-condition: valid-pod and redis-proxy PODs are running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'redis-proxy:valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'redis-proxy:valid-pod:' </ins> ### Stop multiple PODs at once # Pre-condition: valid-pod and redis-proxy PODs are running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'redis-proxy:valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'redis-proxy:valid-pod:' </ins> # Command kubectl stop pods valid-pod redis-proxy "${kube_flags[@]}" # stop multiple pods at once # Post-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create valid-pod POD # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Label the valid-pod POD # Pre-condition: valid-pod is not labelled <del> kube::test::get_object_assert 'pod valid-pod' '{{range.labels}}{{.}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert 'pod valid-pod' "{{range.$labels_field}}{{.}}:{{end}}" 'valid-pod:' </ins> # Command kubectl label pods valid-pod new-name=new-valid-pod "${kube_flags[@]}" # Post-conditon: valid-pod is labelled <del> kube::test::get_object_assert 'pod valid-pod' '{{range.labels}}{{.}}:{{end}}' 'valid-pod:new-valid-pod:' </del> <ins> kube::test::get_object_assert 'pod valid-pod' "{{range.$labels_field}}{{.}}:{{end}}" 'valid-pod:new-valid-pod:' </ins> ### Delete POD by label # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command kubectl delete pods -lnew-name=new-valid-pod "${kube_flags[@]}" # Post-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create valid-pod POD # Pre-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}" # Post-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> ### Overwriting an existing label is not permitted # Pre-condition: name is valid-pod <del> kube::test::get_object_assert 'pod valid-pod' '{{.labels.name}}' 'valid-pod' </del> <ins> kube::test::get_object_assert 'pod valid-pod' "{{.${labels_field}.name}}" 'valid-pod' </ins> # Command ! kubectl label pods valid-pod name=valid-pod-super-sayan "${kube_flags[@]}" # Post-condition: name is still valid-pod <del> kube::test::get_object_assert 'pod valid-pod' '{{.labels.name}}' 'valid-pod' </del> <ins> kube::test::get_object_assert 'pod valid-pod' "{{.${labels_field}.name}}" 'valid-pod' </ins> ### --overwrite must be used to overwrite existing label # Pre-condition: name is valid-pod <del> kube::test::get_object_assert 'pod valid-pod' '{{.labels.name}}' 'valid-pod' </del> <ins> kube::test::get_object_assert 'pod valid-pod' "{{.${labels_field}.name}}" 'valid-pod' </ins> # Command kubectl label --overwrite pods valid-pod name=valid-pod-super-sayan "${kube_flags[@]}" # Post-condition: name is valid-pod-super-sayan <del> kube::test::get_object_assert 'pod valid-pod' '{{.labels.name}}' 'valid-pod-super-sayan' </del> <ins> kube::test::get_object_assert 'pod valid-pod' "{{.${labels_field}.name}}" 'valid-pod-super-sayan' </ins> ### Delete POD by label # Pre-condition: valid-pod POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' 'valid-pod:' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:' </ins> # Command kubectl delete pods -lname=valid-pod-super-sayan "${kube_flags[@]}" # Post-condition: no POD is running <del> kube::test::get_object_assert pods '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ##############

Discussion:
This works: Are we using /var/run for testing?
Curiously travis shows a similar error message regarding /var/run/kubernetes, but it isn't failing: I suspect the /var/run/kubernetes issue is not what's causing the failure here.
However, I am able to reproduce the failure on my machine. I note that in your case, the fatal error says For me, it says The ip addresses showing through here (which appear to be in the GCE space?) are worrying.
It seems it still failing. I've run it locally and it failed with the following error: The aforementioned line: I think it is expected that there are some pods started by k8s (e.g. elasticsearch). Does it mean the test has a bug?
Strangely the same code () passes tests on travis (https://travis-)
I think you're reading it backwards. The test is expecting no pods to be started, but finding the k8s add-on pods, which is normal if it were running against a normal master. In Travis, it's a synthetic environment with no add-ons. This should be assigned to whoever the checks (on mobile.. I know I merged the PR but don't remember who :)). We need to exclude the add-ons (perhaps by finally getting around to putting them in a separate namespace).
the assertions, so CC'ing for comment.
I looked into this with and it seems that test- may fail locally depending on the kubeconfig. Some commands are using defaults for kubectl and thus sometimes they contact another cluster. I'll send a PR to fix this.