google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
16.69k stars 2.3k forks source link

can't access to web interface #2234

Open Nurlan199206 opened 5 years ago

Nurlan199206 commented 5 years ago

Снимок экрана 2019-05-05 в 21 51 37 Someone have yaml file of cadvisor for minikube? i'm trying deploy with this config, but web interface unavailable.

apiVersion: apps/v1 # for Kubernetes versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: cadvisor
  namespace: cadvisor
  annotations:
      seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec:
  selector:
    matchLabels:
      name: cadvisor
  template:
    metadata:
      labels:
        name: cadvisor
    spec:
      serviceAccountName: cadvisor
      containers:
      - name: cadvisor-1
        image: k8s.gcr.io/cadvisor:v0.30.2
        resources:
          requests:
            memory: 200Mi
            cpu: 150m
          limits:
            cpu: 300m
        volumeMounts:
        - name: rootfs
          mountPath: /rootfs
          readOnly: true
        - name: var-run
          mountPath: /var/run
          readOnly: true
        - name: sys
          mountPath: /sys
          readOnly: true
        - name: docker
          mountPath: /var/lib/docker
          readOnly: true
        - name: disk
          mountPath: /dev/disk
          readOnly: true
        ports:
          - name: http
            containerPort: 8080
            protocol: TCP
      automountServiceAccountToken: false
      terminationGracePeriodSeconds: 30
      volumes:
      - name: rootfs
        hostPath:
          path: /
      - name: var-run
        hostPath:
          path: /var/run
      - name: sys
        hostPath:
          path: /sys
      - name: docker
        hostPath:
          path: /var/lib/docker
      - name: disk
        hostPath:
          path: /dev/disk

---
apiVersion: v1
kind: Service
metadata:
  name: cadvisor
  namespace: cadvisor
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port:   '9090'

spec:
  selector:
    app: cadvisor
  type: NodePort
  ports:
    - port: 8080
      targetPort: 8080
      nodePort: 30002
kubectl get pods --all-namespaces
NAMESPACE     NAME                                        READY   STATUS             RESTARTS   AGE
cadvisor      cadvisor-59b689b4b8-8mb9c                   1/1     Running            0          15m
kubectl get svc --all-namespaces
NAMESPACE     NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
cadvisor      cadvisor               NodePort    10.103.182.28   <none>        8080:30002/TCP           15m
dashpole commented 5 years ago

can you curl cAdvisor locally?

Nurlan199206 commented 5 years ago

problem solved.

https://192.168.0.105:10250/metrics/cadvisor

for my virtualbox cadvisor link above.

Nurlan199206 commented 5 years ago

Снимок экрана 2019-05-12 в 18 58 34

dashpole commented 5 years ago

I think you are querying the cAdvisor in the kubelet (port 10250), not your daemonset.