Kubernetes - Kubectl custom-columns for RC Replicas returns strange value

4/30/2018

Does anyone have a clue why ".spec.replicas" would return this strange hex value?

kubectl get rc -o=custom-columns=NAME:metadata.name,REPLICAS:.spec.replicas
NAME                      REPLICAS
devopsproxy               0xc20811d328
prd-devopsproxy-rs-etl    0xc20811d448

Thanks, Drew

-- Drew
kubernetes

1 Answer

4/30/2018

The replicas field is a pointer: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/core/v1/types.go#L3036

It is not getting dereferenced to show you the literal value, but is displaying the memory address of the field

What version of kubectl are you using? This displays correctly for me:

$ kubectl get rc -o=custom-columns=NAME:metadata.name,REPLICAS:.spec.replicas
NAME       REPLICAS
frontend   1
-- Jordan Liggitt
Source: StackOverflow