Skip to content

Add kubectl install to Dockerfile with multi-arch support - #1237

Merged
geoffrey1330 merged 4 commits into
mainfrom
install_kubectl
Aug 13, 2026
Merged

Add kubectl install to Dockerfile with multi-arch support#1237
geoffrey1330 merged 4 commits into
mainfrom
install_kubectl

Conversation

@geoffrey1330

Copy link
Copy Markdown
Collaborator

No description provided.

@boddumanohar

Copy link
Copy Markdown
Member

can you please trigger security scan for this and check if its alright.

https://github.com/simplyblock/sbcli/actions/workflows/security.yml

@geoffrey1330

Copy link
Copy Markdown
Collaborator Author

can you please trigger security scan for this and check if its alright.

https://github.com/simplyblock/sbcli/actions/workflows/security.yml

The scan as result of this package

# golang.org/x/net — kubectl embeds < 0.56.0; fix requires x/net >= 0.56.0

@boddumanohar

Copy link
Copy Markdown
Member

Looks like the scan is failing for this branch. But works fine for main branch. Do you already know how to fix it?

@geoffrey1330

Copy link
Copy Markdown
Collaborator Author

Looks like the scan is failing for this branch. But works fine for main branch. Do you already know how to fix it?

The fix will be to cut a new kubectl release compiled with patched module versions. don't know if we should do that or not.

@boddumanohar

Copy link
Copy Markdown
Member

definitely not 😅 . why is this kubectl binary required?

@geoffrey1330

Copy link
Copy Markdown
Collaborator Author

definitely not 😅 . why is this kubectl binary required?

To run the collect logs script from the admin-control pod to be able to collect logs from pods

@geoffrey1330

Copy link
Copy Markdown
Collaborator Author

definitely not 😅 . why is this kubectl binary required?

To run the collect logs script from the admin-control pod to be able to collect logs from pods

https://github.com/simplyblock/sbcli/blob/main/simplyblock_core/scripts/collect_logs.py

@boddumanohar

boddumanohar commented Aug 12, 2026

Copy link
Copy Markdown
Member

Since kubernetes python library is already present, I think we should use those libraries

  • kubectl get pods --> CoreV1Api.list_namespaced_pod
  • kubectl logs --> CoreV1Api.read_namespaced_pod_log
  • kubectl exec (uptime/dmesg) --> kubernetes.stream.stream(api.connect_get_namespaced_pod_exec, ...)

we should also think about how kubeconfig is passed.

@geoffrey1330

Copy link
Copy Markdown
Collaborator Author

Since kubernetes python library is already present, I think we should use those libraries

  • kubectl get pods --> CoreV1Api.list_namespaced_pod
  • kubectl logs --> CoreV1Api.read_namespaced_pod_log
  • kubectl exec (uptime/dmesg) --> kubernetes.stream.stream(api.connect_get_namespaced_pod_exec, ...)

we should also think about how kubeconfig is passed.

Hmm, I see. I will check how possible this is to get large amount of log data.

@boddumanohar

Copy link
Copy Markdown
Member

if its too much of an effort, we can ignore this security scan. what do you think?

@geoffrey1330

Copy link
Copy Markdown
Collaborator Author

if its too much of an effort, we can ignore this security scan. what do you think?

it seems to have worked

[simplyblock@ocp-installer-r6pzk-master-0 scripts]$ NS=simplyblock
MGMT_IP=172.30.232.110
MON_SECRET='sWbpOgba1bKnCfcPkVQi'
START='2026-08-12T11:35:00'
MINS=15
OUT=/tmp/logs
MODE=kubernetes
python3 collect_logs.py "$START" "$MINS" \
  --monitoring-secret "$MON_SECRET" \
  --namespace "$NS" \
  --output-dir "$OUT" \
  --mgmt-ip "$MGMT_IP" --mode "$MODE"
================================================================
  Simplyblock Log Collector
================================================================
  Window : 2026-08-12T11:35:00.000Z  →  2026-08-12T11:50:00.000Z  (15 min)
  Deploy : kubernetes
  Mode   : Graylog REST API
[1] Retrieving cluster info …
    Cluster UUID : 1b6c799f-1a35-48f2-97ee-25c7c2da969f
    Secret       : ********…  (len=20)
[2] Resolving management node …
    Using provided IP : 172.30.232.110
[3] Retrieving storage nodes …
    Found 9 storage node(s).
    Using provided --monitoring-secret for Graylog auth.
[4] Checking Graylog at http://172.30.232.110:9000/api …
    OK  (version 5.0.13+083613e)
[5] Collecting control-plane logs (27 services, mode=kubernetes) …
    total entries: 0
  simplyblock-control                               0 lines
    total entries: 4497
  webappapi                                     4,497 lines
    total entries: 49006
  storage-node-monitor                         49,006 lines
    total entries: 876
  mgmt-node-monitor                               876 lines
    total entries: 30
  lvol-stats-collector                             30 lines
    total entries: 6390
  main-distr-event-collector                    6,390 lines
    total entries: 8430
  capacity-and-stats-collector                  8,430 lines
    total entries: 60
  capacity-monitor                                 60 lines
    total entries: 55037
  health-check                                 55,037 lines
    total entries: 117
  device-monitor                                  117 lines
    total entries: 30
  lvol-monitor                                     30 lines
    total entries: 57
  snapshot-monitor                                 57 lines
    total entries: 0
  tasks-node-add-runner                             0 lines
    total entries: 29481
  tasks-runner-restart                         29,481 lines
    total entries: 2958
  tasks-runner-migration                        2,958 lines
    total entries: 0
  tasks-runner-lvol-migration                       0 lines
    total entries: 26
  tasks-runner-failed-migration                    26 lines
    total entries: 5023
  tasks-runner-cluster-status                   5,023 lines
    total entries: 0
  tasks-runner-new-device-migration                 0 lines
    total entries: 6810
  tasks-runner-port-allow                       6,810 lines
    total entries: 0
  tasks-runner-jc-comp-resume                       0 lines
    total entries: 0
  tasks-runner-sync-lvol-del                        0 lines
    total entries: 0
  tasks-runner-cluster-expand                       0 lines
    total entries: 3326
  tasks-runner-node-removal                     3,326 lines
    total entries: 0
  tasks-runner-snapshot-replication                 0 lines
    total entries: 14
  tasks-runner-backup                              14 lines
    total entries: 14
  tasks-runner-backup-merge                        14 lines
  Control-plane total                         172,182 lines
[6] Collecting storage-node logs (kubernetes) …
  Node: ocp-installer-r6pzk-worker-a-hzh8v_4424  ip=10.0.128.7  rpc_port=4424
    total entries: 13554
    spdk-container                               13,554 lines
    total entries: 32101
    spdk-proxy-container                         32,101 lines
  Node: ocp-installer-r6pzk-worker-a-zgrbl_4425  ip=10.0.128.6  rpc_port=4425
    total entries: 13075
    spdk-container                               13,075 lines
    total entries: 30754
    spdk-proxy-container                         30,754 lines
  Node: ocp-installer-r6pzk-worker-a-4rwwh_4426  ip=10.0.128.2  rpc_port=4426
    total entries: 6450
    spdk-container                                6,450 lines
    total entries: 14686
    spdk-proxy-container                         14,686 lines
  Node: ocp-installer-r6pzk-worker-a-cs27n_4427  ip=10.0.128.3  rpc_port=4427
    total entries: 14484
    spdk-container                               14,484 lines
    total entries: 31612
    spdk-proxy-container                         31,612 lines
  Node: ocp-installer-r6pzk-worker-a-5hkhm_4433  ip=10.0.128.99  rpc_port=4433
    total entries: 13331
    spdk-container                               13,331 lines
    total entries: 31159
    spdk-proxy-container                         31,159 lines
  Node: ocp-installer-r6pzk-worker-a-5x4n5_4436  ip=10.0.128.100  rpc_port=4436
    total entries: 10833
    spdk-container                               10,833 lines
    total entries: 22746
    spdk-proxy-container                         22,746 lines
  Node: ocp-installer-r6pzk-worker-a-9jc7b_4422  ip=10.0.128.101  rpc_port=4422
    total entries: 13389
    spdk-container                               13,389 lines
    total entries: 30612
    spdk-proxy-container                         30,612 lines
  Node: ocp-installer-r6pzk-worker-a-dksw8_4431  ip=10.0.128.98  rpc_port=4431
    total entries: 13069
    spdk-container                               13,069 lines
    total entries: 29834
    spdk-proxy-container                         29,834 lines
  Node: ocp-installer-r6pzk-worker-a-nx4p8_4435  ip=10.0.128.5  rpc_port=4435
    total entries: 13374
    spdk-container                               13,374 lines
    total entries: 29660
    spdk-proxy-container                         29,660 lines
[7] Collecting Kubernetes pod logs (namespace: simplyblock) …
  CSI node pods (10) …
      simplyblock-csi-node-2hgpm / csi-registrar
      simplyblock-csi-node-2hgpm / csi-node
      simplyblock-csi-node-2hgpm / csi-node (dmesg)
      simplyblock-csi-node-9rfpc / csi-registrar
      simplyblock-csi-node-9rfpc / csi-node
      simplyblock-csi-node-9rfpc / csi-node (dmesg)
      simplyblock-csi-node-cr56b / csi-registrar
      simplyblock-csi-node-cr56b / csi-node
      simplyblock-csi-node-cr56b / csi-node (dmesg)
      simplyblock-csi-node-dc7zj / csi-registrar
      simplyblock-csi-node-dc7zj / csi-node
      simplyblock-csi-node-dc7zj / csi-node (dmesg)
      simplyblock-csi-node-htkz6 / csi-registrar
      simplyblock-csi-node-htkz6 / csi-node
      simplyblock-csi-node-htkz6 / csi-node (dmesg)
      simplyblock-csi-node-lv44w / csi-registrar
      simplyblock-csi-node-lv44w / csi-node
      simplyblock-csi-node-lv44w / csi-node (dmesg)
      simplyblock-csi-node-pkwhn / csi-registrar
      simplyblock-csi-node-pkwhn / csi-node
      simplyblock-csi-node-pkwhn / csi-node (dmesg)
      simplyblock-csi-node-pwcxt / csi-registrar
      simplyblock-csi-node-pwcxt / csi-node
      simplyblock-csi-node-pwcxt / csi-node (dmesg)
      simplyblock-csi-node-t5btr / csi-registrar
      simplyblock-csi-node-t5btr / csi-node
      simplyblock-csi-node-t5btr / csi-node (dmesg)
      simplyblock-csi-node-wckgk / csi-registrar
      simplyblock-csi-node-wckgk / csi-node
      simplyblock-csi-node-wckgk / csi-node (dmesg)
  CSI controller pods (1) …
      simplyblock-csi-controller-0 / csi-provisioner
      simplyblock-csi-controller-0 / csi-snapshotter
      simplyblock-csi-controller-0 / csi-attacher
      simplyblock-csi-controller-0 / csi-resizer
      simplyblock-csi-controller-0 / csi-health-monitor
      simplyblock-csi-controller-0 / csi-controller
  No simplyblock-manager pods found in namespace simplyblock.
  Storage-node DS pods (9) …
      simplyblock-storage-node-ds-simplyblock-node-745wn / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-745wn / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-745wn / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-984tm / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-984tm / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-984tm / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-cq8sw / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-cq8sw / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-cq8sw / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-dp5dv / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-dp5dv / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-dp5dv / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-lh8lt / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-lh8lt / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-lh8lt / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-m8vz6 / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-m8vz6 / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-m8vz6 / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-nhl9v / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-nhl9v / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-nhl9v / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-pgjkr / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-pgjkr / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-pgjkr / s-node-api-container
      simplyblock-storage-node-ds-simplyblock-node-rz4wf / node-env-writer
      simplyblock-storage-node-ds-simplyblock-node-rz4wf / s-node-api-config-generator
      simplyblock-storage-node-ds-simplyblock-node-rz4wf / s-node-api-container
[8] Collecting sbctl cluster / node info …
  sbctl cluster show                                 OK  (cluster_show.txt)
  sbctl lvol list                                    OK  (lvol_list.json)
  sbctl sn list                                      OK  (sn_list.json)
  sbctl sn check  (per node) …
    ocp-installer-r6pzk-worker-a-hzh8v_4424_10.0.128.7
    ocp-installer-r6pzk-worker-a-zgrbl_4425_10.0.128.6
    ocp-installer-r6pzk-worker-a-4rwwh_4426_10.0.128.2
    ocp-installer-r6pzk-worker-a-cs27n_4427_10.0.128.3
    ocp-installer-r6pzk-worker-a-5hkhm_4433_10.0.128.99
    ocp-installer-r6pzk-worker-a-5x4n5_4436_10.0.128.100
    ocp-installer-r6pzk-worker-a-9jc7b_4422_10.0.128.101
    ocp-installer-r6pzk-worker-a-dksw8_4431_10.0.128.98
    ocp-installer-r6pzk-worker-a-nx4p8_4435_10.0.128.5
  sbctl cluster get-logs --limit 0                   OK  (cluster_get_logs.txt)
[9] Creating tarball …
================================================================
  Done!
  Tarball : /tmp/logs/sb_logs_20260812_113500_15m.tar.gz
  Size    : 9.56 MB
================================================================

@geoffrey1330
geoffrey1330 merged commit b23b8d1 into main Aug 13, 2026
11 checks passed
@geoffrey1330
geoffrey1330 deleted the install_kubectl branch August 13, 2026 08:27
RaunakJalan pushed a commit that referenced this pull request Aug 31, 2026
* Add kubectl install to Dockerfile with multi-arch support

* Fix kubectl not found by installing to /usr/local/bin

* replace kubectl binary with kubernetes Python client in collect_logs.py and add missing task-runner services

* fix collect_logs: use since_seconds instead of since_time and replace kubectl with kubernetes Python client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants