Sunday, August 3, 2025

OCP k8s CRC local monitoring

 HOWTO



Add memory 


$ crc stop
INFO Stopping kubelet and all containers...       
INFO Stopping the instance, this may take a few minutes... 
Stopped the instance
dave@fedora:~/Downloads$ crc config set memory 14336
Changes to configuration property 'memory' are only applied when the CRC instance is started.
If you already have a running CRC instance, then for this configuration change to take effect, stop the CRC instance with 'crc stop' and restart it with 'crc start'.
dave@fedora:~/Downloads$  crc config set enable-cluster-monitoring true
Successfully configured enable-cluster-monitoring to true
dave@fedora:~/Downloads$ crc start

Monitoring 


dave@fedora:~/Downloads$ oc config use-context crc-admin
Switched to context "crc-admin".
dave@fedora:~/Downloads$ oc whoami
kubeadmin
dave@fedora:~/Downloads$ oc get clusterversion version -ojsonpath='{range .spec.overrides[*]}{.name}{"\n"}{end}' | nl -v -2
    -2    cluster-monitoring-operator
    -1    monitoring
     0    cloud-credential-operator
     1    cloud-credential
     2    cluster-autoscaler-operator
     3    cluster-autoscaler
     4    cluster-cloud-controller-manager-operator
     5    cloud-controller-manager
dave@fedora:~/Downloads$ crc config set enable-cluster-monitoring true
Successfully configured enable-cluster-monitoring to true




Pod YAML

kind: Pod
apiVersion: v1
metadata:
  name: demo
  namespace: demo
  uid: 6be00704-f3ca-4d4b-9af6-f6bee0494ba1
  resourceVersion: '37632'
  creationTimestamp: '2025-08-03T09:24:59Z'
  labels:
    run: demo
  annotations:
    k8s.ovn.org/pod-networks: '{"default":{"ip_addresses":["10.217.0.66/23"],"mac_address":"0a:58:0a:d9:00:42","gateway_ips":["10.217.0.1"],"routes":[{"dest":"10.217.0.0/22","nextHop":"10.217.0.1"},{"dest":"10.217.4.0/23","nextHop":"10.217.0.1"},{"dest":"169.254.0.5/32","nextHop":"10.217.0.1"},{"dest":"100.64.0.0/16","nextHop":"10.217.0.1"}],"ip_address":"10.217.0.66/23","gateway_ip":"10.217.0.1","role":"primary"}}'
    k8s.v1.cni.cncf.io/network-status: |-
      [{
          "name": "ovn-kubernetes",
          "interface": "eth0",
          "ips": [
              "10.217.0.66"
          ],
          "mac": "0a:58:0a:d9:00:42",
          "default": true,
          "dns": {}
      }]
    openshift.io/scc: anyuid
  managedFields:
    - manager: crc
      operation: Update
      apiVersion: v1
      time: '2025-08-03T09:24:59Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:k8s.ovn.org/pod-networks': {}
      subresource: status
    - manager: kubectl-run
      operation: Update
      apiVersion: v1
      time: '2025-08-03T09:24:59Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:labels':
            .: {}
            'f:run': {}
        'f:spec':
          'f:containers':
            'k:{"name":"demo"}':
              .: {}
              'f:command': {}
              'f:image': {}
              'f:imagePullPolicy': {}
              'f:name': {}
              'f:resources': {}
              'f:terminationMessagePath': {}
              'f:terminationMessagePolicy': {}
          'f:dnsPolicy': {}
          'f:enableServiceLinks': {}
          'f:restartPolicy': {}
          'f:schedulerName': {}
          'f:securityContext': {}
          'f:terminationGracePeriodSeconds': {}
    - manager: multus-daemon
      operation: Update
      apiVersion: v1
      time: '2025-08-03T09:24:59Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:k8s.v1.cni.cncf.io/network-status': {}
      subresource: status
    - manager: kubelet
      operation: Update
      apiVersion: v1
      time: '2025-08-03T09:55:05Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:status':
          'f:conditions':
            'k:{"type":"ContainersReady"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"Initialized"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"PodReadyToStartContainers"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"Ready"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:status': {}
              'f:type': {}
          'f:containerStatuses': {}
          'f:hostIP': {}
          'f:hostIPs': {}
          'f:phase': {}
          'f:podIP': {}
          'f:podIPs':
            .: {}
            'k:{"ip":"10.217.0.66"}':
              .: {}
              'f:ip': {}
          'f:startTime': {}
      subresource: status
spec:
  restartPolicy: Always
  serviceAccountName: default
  imagePullSecrets:
    - name: default-dockercfg-p7cfm
  priority: 0
  schedulerName: default-scheduler
  enableServiceLinks: true
  terminationGracePeriodSeconds: 30
  preemptionPolicy: PreemptLowerPriority
  nodeName: crc
  securityContext:
    seLinuxOptions:
      level: 's0:c26,c0'
  containers:
    - resources: {}
      terminationMessagePath: /dev/termination-log
      name: demo
      command:
        - sleep
        - 600s
      securityContext:
        capabilities:
          drop:
            - MKNOD
      imagePullPolicy: Always
      volumeMounts:
        - name: kube-api-access-z7xrc
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePolicy: File
      image: 'image-registry.openshift-image-registry.svc:5000/demo/ubi8@sha256:0686ee6a1b9f7a4eb706b3562e50bbf55b929a573f6055a1128052b4b2266a2c'
  serviceAccount: default
  volumes:
    - name: kube-api-access-z7xrc
      projected:
        sources:
          - serviceAccountToken:
              expirationSeconds: 3607
              path: token
          - configMap:
              name: kube-root-ca.crt
              items:
                - key: ca.crt
                  path: ca.crt
          - downwardAPI:
              items:
                - path: namespace
                  fieldRef:
                    apiVersion: v1
                    fieldPath: metadata.namespace
          - configMap:
              name: openshift-service-ca.crt
              items:
                - key: service-ca.crt
                  path: service-ca.crt
        defaultMode: 420
  dnsPolicy: ClusterFirst
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
status:
  containerStatuses:
    - restartCount: 3
      started: true
      ready: true
      name: demo
      state:
        running:
          startedAt: '2025-08-03T09:55:04Z'
      volumeMounts:
        - name: kube-api-access-z7xrc
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
          readOnly: true
          recursiveReadOnly: Disabled
      imageID: 'image-registry.openshift-image-registry.svc:5000/demo/ubi8@sha256:0686ee6a1b9f7a4eb706b3562e50bbf55b929a573f6055a1128052b4b2266a2c'
      image: 'image-registry.openshift-image-registry.svc:5000/demo/ubi8@sha256:0686ee6a1b9f7a4eb706b3562e50bbf55b929a573f6055a1128052b4b2266a2c'
      lastState:
        terminated:
          exitCode: 0
          reason: Completed
          startedAt: '2025-08-03T09:45:03Z'
          finishedAt: '2025-08-03T09:55:03Z'
          containerID: 'cri-o://fe191488478ade4fb4fbd6f045f4896cdd3128a02cd23c9163dea85039de6efc'
      containerID: 'cri-o://f9351ee373330f42397d46be58820ae2d34616afcddf9be923e30bbd906b5238'
  qosClass: BestEffort
  hostIPs:
    - ip: 192.168.126.11
  podIPs:
    - ip: 10.217.0.66
  podIP: 10.217.0.66
  hostIP: 192.168.126.11
  startTime: '2025-08-03T09:24:59Z'
  conditions:
    - type: PodReadyToStartContainers
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2025-08-03T09:25:03Z'
    - type: Initialized
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2025-08-03T09:24:59Z'
    - type: Ready
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2025-08-03T09:55:05Z'
    - type: ContainersReady
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2025-08-03T09:55:05Z'
    - type: PodScheduled
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2025-08-03T09:24:59Z'
  phase: Running



2 comments:

  1. Thanks for sharing this guide! The step where you bump CRC memory before enabling monitoring was a real lifesaver—I’ve hit issues in the past when I forgot that part. Seeing the full pod manifest spelled out makes it clear how much we rely on YAML to keep everything consistent. Curious if you’ve tested this with larger workloads in CRC?

    ReplyDelete