Я использую java-библиотеку kubernetes-client для REST API K8s. Я хочу изучить описанную здесь функцию мониторинга ресурсов https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
Я установил ресурс для модулей при создании подобных развертываний
// ******************* RESOURCES*********************
Quantity memLimit = new Quantity();
memLimit.setAmount("400");
Map<String, Quantity> memMap = new HashMap<String,Quantity>();
memMap.put("memory", memLimit);
ResourceRequirements resourceRequirements = new ResourceRequirementsBuilder()
.withRequests(memMap)
.build();
// ******************* DEPLOYMENT *********************
Deployment deployment = new DeploymentBuilder()
.withNewMetadata()
.withName("first-deployment")
.endMetadata()
.withNewSpec()
.withReplicas(3)
.withNewTemplate()
.withNewMetadata()
.addToLabels(namespaceID, "hello-world-example")
.endMetadata()
.withNewSpec()
.addNewContainer()
.withName("nginx-one")
.withImage("nginx")
.addNewPort()
.withContainerPort(80)
.endPort()
.withResources(resourceRequirements)
.endContainer()
.endSpec()
.endTemplate()
.endSpec()
.build();
deployment = client.extensions().deployments().inNamespace(namespace).create(deployment);
Как мне теперь узнать, сколько памяти используется из выделенной памяти для подов? В документации говорится, что это часть статуса модуля, но статус модуля имеет форму
(conditions=
[PodCondition
(lastProbeTime=null, lastTransitionTime=2018-01-09T15:53:28Z,
message=null, reason=null,
status=True, type=PodScheduled,
additionalProperties={})],
containerStatuses=[], hostIP=null,
initContainerStatuses=[],
message=null, phase=Pending, podIP=null,
qosClass=Burstable, reason=null,
startTime=null, additionalProperties={})
И статус контейнера
(containerID=null, image=nginx,
imageID=, lastState=ContainerState(running=null, terminated=null, waiting=null, additionalProperties={}),
name=nginx-one, ready=false, restartCount=0, state=ContainerState(running=null, terminated=null, waiting=
ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={}), additionalProperties={}),
additionalProperties={})
Есть ли пример для мониторинга ресурсов на подах?