Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List available bytes for PVCs? #1134

Closed
dev-samples opened this issue May 4, 2021 · 3 comments
Closed

List available bytes for PVCs? #1134

dev-samples opened this issue May 4, 2021 · 3 comments

Comments

@dev-samples
Copy link

Using:

k8s 1.15 in azure/aks
kube-prometheus-stack-9.4.10

I am trying to get Prometheus to list available capacity for a list of PVCs I have created for my k8s cluster in aks/azure.

I can curl a running prometheus and list my PVCs in a cluster with:

    $ curl http://127.0.0.1:9090/api/v1/label/persistentvolumeclaim/values | jq
        {
          "status": "success",
          "data": [
            ...,
            "my-pvc",
            ...
          ]
        }

Which has the below PersistentVolumeClaim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/azure-disk
  finalizers:
  - kubernetes.io/pvc-protection
  name: my-pvc
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 512Gi
  storageClassName: managed-premium
  volumeMode: Filesystem
  volumeName: pvc-g8hhd2e1-f11f-4bfc-a54c-e1b3f0d64c70
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 512Gi
  phase: Bound
...

In the graphql web editor (http://127.0.0.1:9090/graph) I can query its capacity with (using the above volumeName for my-pvc):

kube_persistentvolume_capacity_bytes{persistentvolume="pvc-g8hhd2e1-f11f-4bfc-a54c-e1b3f0d64c70"}

which gives: 549755813888

But more interestingly how do I list the available capacity for that volume?

I found a similar post on the cadvisor project:

google/cadvisor#1702 (comment)

mentioning this metric: kubelet_volume_stats_available_bytes but that is not available.

Any suggestions?

@ArthurSens
Copy link
Member

Looking at the dashboard imported from kubernetes-mixin, all metrics from pvcs comes from kubelet indeed 🤔
image

But looking at kube-state-metrics, there is also another metric that can be helpful: kube_persistentvolumeclaim_resource_requests_storage_bytes. Does that one works for you?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 11, 2021
@github-actions
Copy link

This issue was closed because it has not had any activity in the last 120 days. Please reopen if you feel this is still valid.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants