Reference: https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration
Build the app and push the docker image.
make build
make push
Create the RBAC resources.
kubectl apply -f rbac.yaml
Run the pod-reader app
kubectl run pod-reader --image=bzon/k8s-client-example --serviceaccount=pod-reader --namespace=default
kubectl logs -f pod-reader-6dd9bf767d-5tt85
There are 115 pods in the cluster
There are 115 pods in the cluster
There are 114 pods in the cluster
There are 114 pods in the cluster