Pages

Pages

01 สิงหาคม 2567

kubectl command get list of docker images from kubernetes cluster

To get list of docker images from kubernetes cluster, create new shell script with this content

#!/bin/bash

deployments="$(kubectl get deploy -n YOUR_NAME_SPACE -l version=prod -o name)"
for word in $deployments; do
  contents="$(kubectl get $word -n 
YOUR_NAME_SPACE -o json)"
  jq .spec.template.spec.containers[0].image <<< "$contents"
done

ไม่มีความคิดเห็น:

แสดงความคิดเห็น