项目作者: bzon

项目描述 :
高级语言: Go
项目地址: git://github.com/bzon/k8s-client-example.git
创建时间: 2018-08-30T11:23:49Z
项目社区:https://github.com/bzon/k8s-client-example

开源协议:

下载


Pod Reader, an In-Cluster Kubernetes Client Example

Reference: https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration

Demo

Build the app and push the docker image.

  1. make build
  2. make push

Create the RBAC resources.

  1. kubectl apply -f rbac.yaml

Run the pod-reader app

  1. kubectl run pod-reader --image=bzon/k8s-client-example --serviceaccount=pod-reader --namespace=default
  1. kubectl logs -f pod-reader-6dd9bf767d-5tt85
  2. There are 115 pods in the cluster
  3. There are 115 pods in the cluster
  4. There are 114 pods in the cluster
  5. There are 114 pods in the cluster