Change:
### Create replication controller frontend from JSON # Pre-condition: no replication controller is running <del> kube::test::get_object_assert rc "{{range.items}}{{.id}}:{{end}}" '' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/guestbook/frontend-controller.json "${kube_flags[@]}" # Post-condition: frontend replication controller is running <del> kube::test::get_object_assert rc "{{range.items}}{{.id}}:{{end}}" 'frontend-controller:' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" 'frontend-controller:' </ins> ### Resize replication controller frontend with current-replicas and replicas # Pre-condition: 3 replicas <del> kube::test::get_object_assert 'rc frontend-controller' '{{.desiredState.replicas}}' '3' </del> <ins> kube::test::get_object_assert 'rc frontend-controller' "{{.$rc_replicas_field}}" '3' </ins> # Command kubectl resize --current-replicas=3 --replicas=2 replicationcontrollers frontend-controller "${kube_flags[@]}" # Post-condition: 2 replicas <del> kube::test::get_object_assert 'rc frontend-controller' '{{.desiredState.replicas}}' '2' </del> <ins> kube::test::get_object_assert 'rc frontend-controller' "{{.$rc_replicas_field}}" '2' </ins> ### Resize replication controller frontend with (wrong) current-replicas and replicas # Pre-condition: 2 replicas <del> kube::test::get_object_assert 'rc frontend-controller' '{{.desiredState.replicas}}' '2' </del> <ins> kube::test::get_object_assert 'rc frontend-controller' "{{.$rc_replicas_field}}" '2' </ins> # Command ! kubectl resize --current-replicas=3 --replicas=2 replicationcontrollers frontend-controller "${kube_flags[@]}" # Post-condition: nothing changed <del> kube::test::get_object_assert 'rc frontend-controller' '{{.desiredState.replicas}}' '2' </del> <ins> kube::test::get_object_assert 'rc frontend-controller' "{{.$rc_replicas_field}}" '2' </ins> ### Resize replication controller frontend with replicas only # Pre-condition: 2 replicas <del> kube::test::get_object_assert 'rc frontend-controller' '{{.desiredState.replicas}}' '2' </del> <ins> kube::test::get_object_assert 'rc frontend-controller' "{{.$rc_replicas_field}}" '2' </ins> # Command kubectl resize  --replicas=3 replicationcontrollers frontend-controller "${kube_flags[@]}" # Post-condition: 3 replicas <del> kube::test::get_object_assert 'rc frontend-controller' '{{.desiredState.replicas}}' '3' </del> <ins> kube::test::get_object_assert 'rc frontend-controller' "{{.$rc_replicas_field}}" '3' </ins> ### Delete replication controller with id # Pre-condition: frontend replication controller is running <del> kube::test::get_object_assert rc '{{range.items}}{{.id}}:{{end}}' 'frontend-controller:' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" 'frontend-controller:' </ins> # Command kubectl delete rc frontend-controller "${kube_flags[@]}" # Post-condition: no replication controller is running <del> kube::test::get_object_assert rc '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> ### Create two replication controllers # Pre-condition: no replication controller is running <del> kube::test::get_object_assert rc '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" '' </ins> # Command kubectl create -f examples/guestbook/frontend-controller.json "${kube_flags[@]}" kubectl create -f examples/guestbook/redis-slave-controller.json "${kube_flags[@]}" # Post-condition: frontend and redis-slave <del> kube::test::get_object_assert rc '{{range.items}}{{.id}}:{{end}}' 'frontend-controller:redis-slave-controller:' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" 'frontend-controller:redis-slave-controller:' </ins> ### Delete multiple controllers at once # Pre-condition: frontend and redis-slave <del> kube::test::get_object_assert rc '{{range.items}}{{.id}}:{{end}}' 'frontend-controller:redis-slave-controller:' </del> <ins> kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" 'frontend-controller:redis-slave-controller:' </ins> # Command kubectl delete rc frontend-controller redis-slave-controller "${kube_flags[@]}" # delete multiple controllers at once # Post-condition: no replication controller is running <del> kube::test::get_object_assert rc '{{range.items}}{{.id}}:{{end}}' '' </del> <ins> kube::test::get_object_assert rc "{{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.