<p>I want to collect metrics for PODs in K8s. <code>kube-state-metrics</code> looks good. I was not able to follow the <a href="https://github.com/kubernetes/kube-state-metrics#setup" rel="noreferrer">README</a>. I struck after <code>make container</code>. Is there any simple way to deploy the <code>kube-state-metrics</code>. </p>

<p><strong>UPDATE1</strong></p>

<p>Ran <code>kubectl apply -f kubernetes</code>. Getting below errors. I thinks, version mismatch. Any idea how to overcome?</p>

<pre><code>serviceaccount "kube-state-metrics" configured
service "kube-state-metrics" configured
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-cluster-role-binding.yaml": ClusterRoleBinding in version "v1" cannot be handled as a ClusterRoleBinding: no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-cluster-role.yaml": ClusterRole in version "v1" cannot be handled as a ClusterRole: no kind "ClusterRole" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-deployment.yaml": Deployment in version "v1beta2" cannot be handled as a Deployment: no kind "Deployment" is registered for version "apps/v1beta2"
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-role-binding.yaml": RoleBinding in version "v1" cannot be handled as a RoleBinding: no kind "RoleBinding" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-role.yaml": Role in version "v1" cannot be handled as a Role: no kind "Role" is registered for version "rbac.authorization.k8s.io/v1"
</code></pre>

<p>You're close.</p>

<p>Same page has a <code>Kubernetes Deployment</code> section.</p>

<p><a href="https://github.com/kubernetes/kube-state-metrics#kubernetes-deployment" rel="noreferrer">https://github.com/kubernetes/kube-state-metrics#kubernetes-deployment</a></p>

<p>Once you clone the github repository you simple run:</p>

<p><code>kubectl apply -f kubernetes</code></p>

<p>You can take a closer look at the deployment files here:</p>

<p><a href="https://github.com/kubernetes/kube-state-metrics/tree/master/kubernetes" rel="noreferrer">https://github.com/kubernetes/kube-state-metrics/tree/master/kubernetes</a></p>

<p>--- UPDATE ---</p>

<p>If you're running an older version of K8s, which still uses Deployment version v1beta1 and no RBAC try the following (yaml file) example:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: kube-state-metrics-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        k8s-app: kube-state-metrics
        version: "v0.4.1"
    spec:
      containers:
      - name: kube-state-metrics
        image: gcr.io/google_containers/kube-state-metrics:v0.4.1
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  name: kube-state-metrics
  labels:
    k8s-app: kube-state-metrics
spec:
  ports:
  - name: http-metrics
    port: 8080
    protocol: TCP
  selector:
    k8s-app: kube-state-metrics
</code></pre>
