xetys / hetzner-kube

A CLI tool for provisioning kubernetes clusters on Hetzner Cloud
Apache License 2.0
745 stars 116 forks source link

Unable to install metric-server #289

Closed tckb closed 5 years ago

tckb commented 5 years ago

Hi,

I am trying to install metric server and perhaps, due to the communication issues, the metric-server is not able to collect the metrics.

the error:

                                                                                                                                                          Autoscroll: On   │
│ I1028 11:56:51.081021       1 serving.go:273] Generated self-signed cert (apiserver.local.config/certificates/apiserver.crt, apiserver.local.config/certificates/apiserve │
│ r.key)                                                                                                                                                                    │
│ [restful] 2019/10/28 11:56:52 log.go:33: [restful/swagger] listing is available at https://:443/swaggerapi                                                                │
│ [restful] 2019/10/28 11:56:52 log.go:33: [restful/swagger] https://:443/swaggerui/ is mapped to folder /swagger-ui/                                                       │
│ I1028 11:56:52.969045       1 serve.go:96] Serving securely on [::]:443                                                                                                   │
│ E1028 11:57:05.400462       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/kube-controller-manager-tckb-k8s-master-01: no metrics known for pod    │
│ E1028 11:57:05.401401       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/hcloud-csi-controller-0: no metrics known for pod                       │
│ E1028 11:57:05.404642       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/kube-proxy-t4jcw: no metrics known for pod                              │
│ E1028 11:57:05.404698       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/etcd-tckb-k8s-master-01: no metrics known for pod                       │
│ E1028 11:57:05.404708       1 reststorage.go:144] unable to fetch pod metrics for pod gitlab-managed-apps/tiller-deploy-67cb9b4f5b-bm59d: no metrics known for pod        │
│ E1028 11:57:05.404722       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/kube-scheduler-tckb-k8s-master-01: no metrics known for pod             │
│ E1028 11:57:05.404744       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/canal-fph2f: no metrics known for pod                                   │
│ E1028 11:57:05.404752       1 reststorage.go:144] unable to fetch pod metrics for pod cert-manager/cert-manager-webhook-645b8bdb7-qc8wv: no metrics known for pod         │
│ E1028 11:57:05.404771       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/metrics-server-c896f4749-rkhrn: no metrics known for pod                │
│ E1028 11:57:05.404809       1 reststorage.go:144] unable to fetch pod metrics for pod kube-system/kube-apiserver-tckb-k8s-master-01: no metrics known for pod             │
│ E1028 11:57:05.404823       1 reststorage.go:144] unable to fetch pod metrics for pod metallb-system/speaker-fk6h9: no metrics known for pod                              │
│ E1028 11:57:05.404830       1 reststorage.go:144] unable to fetch pod metrics for pod mailserver/poste-mailserver-74bf4b7cd4-swff9: no metrics known for pod

here's my configuration:

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: metrics-server
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: metrics-server:system:auth-delegator
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:auth-delegator
subjects:
  - kind: ServiceAccount
    name: metrics-server
    namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: metrics-server-auth-reader
  namespace: kube-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: extension-apiserver-authentication-reader
subjects:
  - kind: ServiceAccount
    name: metrics-server
    namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: system:metrics-server
rules:
  - apiGroups:
      - ""
    resources:
      - pods
      - nodes
      - nodes/stats
      - namespaces
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - "extensions"
    resources:
      - deployments
    verbs:
      - get
      - list
      - watch
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: system:aggregated-metrics-reader
  labels:
    rbac.authorization.k8s.io/aggregate-to-view: "true"
    rbac.authorization.k8s.io/aggregate-to-edit: "true"
    rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
  - apiGroups: ["metrics.k8s.io"]
    resources: ["pods"]
    verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: system:metrics-server
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:metrics-server
subjects:
  - kind: ServiceAccount
    name: metrics-server
    namespace: kube-system
---
apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService
metadata:
  name: v1beta1.metrics.k8s.io
spec:
  service:
    name: metrics-server
    namespace: kube-system
  group: metrics.k8s.io
  version: v1beta1
  insecureSkipTLSVerify: true
  groupPriorityMinimum: 100
  versionPriority: 100
---
apiVersion: v1
kind: Service
metadata:
  name: metrics-server
  namespace: kube-system
  labels:
    kubernetes.io/name: "Metrics-server"
spec:
  selector:
    k8s-app: metrics-server
  ports:
    - port: 443
      protocol: TCP
      targetPort: 443
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: metrics-server
  namespace: kube-system
  labels:
    k8s-app: metrics-server
spec:
  selector:
    matchLabels:
      k8s-app: metrics-server
  template:
    metadata:
      name: metrics-server
      labels:
        k8s-app: metrics-server
    spec:
      serviceAccountName: metrics-server
      volumes:
        # mount in tmp so we can safely use from-scratch images and/or read-only containers
        - name: tmp-dir
          emptyDir: {}
      containers:
        - name: metrics-server
          image: gcr.io/google_containers/metrics-server-amd64:v0.3.1
          imagePullPolicy: Always
          command:
            - /metrics-server
            - --kubelet-preferred-address-types=InternalIP,Hostname,ExternalIP
            - --kubelet-insecure-tls
          volumeMounts:
            - name: tmp-dir
              mountPath: /tmp

Is there something I'm missing ?

tckb commented 5 years ago

Oops, took a while to populate. the above config worked. closing this issue