Introduction:
In the dynamic landscape of Kubernetes deployments, managing and deploying container images are fundamental tasks. This guide will walk you through essential techniques using Helm and kubectl to fetch a list of images from your Kubernetes platform, regardless of the specific application.Prerequisites:
Before proceeding, make sure you have the following tools installed:
Fetching Images from Helm Charts: Helm simplifies the process of fetching images from charts. Use the following command, replacing version numbers and paths as per your configuration:
helm template --version 0.31.2 YOUR_CHART_NAME | grep "image: " | awk '{print $2}' | sort -u
Fetching Images from Running Pods: Alternatively, you can directly retrieve images from running pods using kubectl:
kubectl get pods -n YOUR_NAMESPACE -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort -u
Fetching Images from Extracted Helm Chart: If you have the Helm chart locally, follow these steps:
- Download the Helm chart:
wget YOUR_HELM_CHART_URL tar -zxvf YOUR_HELM_CHART_NAME.tgz
- Extract and inspect values files:
find /path/to/your/chart -maxdepth 3 -type f -name 'values*' -exec grep -A1 'repository:' {} \; | awk '/repository:/ {printf "%s:", $2} /tag:/ {print $2}'
Replace /path/to/your/chart
with the actual path where you extracted the Helm chart.
Handling Compatibility Issues:
In some cases, you may encounter compatibility issues. If your Kubernetes version is unsupported, use the following command with theforceIncompatibleKubernetes
flag:
helm template --version YOUR_CHART_VERSION YOUR_CHART_NAME --set forceIncompatibleKubernetes=true --debug| grep "image: " | awk '{print $2}' | sort -u
Ensure your Kubernetes version aligns with the supported versions of your application.
Example Outputs:
==========================================================================================
helm template --version 0.31.2 astronomer/astronomer | grep "image: " | awk '{print $2}' | sort -u
==========================================================================================
quay.io/astronomer/ap-alertmanager:0.25.0
quay.io/astronomer/ap-astro-ui:0.31.12
quay.io/astronomer/ap-base:3.16.3
quay.io/astronomer/ap-cli-install:0.26.11
quay.io/astronomer/ap-commander:0.31.4
quay.io/astronomer/ap-configmap-reloader:0.8.0
quay.io/astronomer/ap-curator:5.8.4-23
quay.io/astronomer/ap-db-bootstrapper:0.31.0
quay.io/astronomer/ap-default-backend:0.28.12
quay.io/astronomer/ap-elasticsearch:7.17.8
quay.io/astronomer/ap-elasticsearch-exporter:1.5.0
quay.io/astronomer/ap-fluentd:1.15.3-1
quay.io/astronomer/ap-grafana:8.5.16
quay.io/astronomer/ap-houston-api:0.31.16
quay.io/astronomer/ap-init:3.16.3
quay.io/astronomer/ap-kibana:7.17.8
quay.io/astronomer/ap-kube-state:2.7.0
quay.io/astronomer/ap-nats-exporter:0.10.0-3
quay.io/astronomer/ap-nats-server:2.8.4
quay.io/astronomer/ap-nats-streaming:0.24.6
quay.io/astronomer/ap-nginx:1.3.1-2
quay.io/astronomer/ap-nginx-es:1.23.3-1
quay.io/astronomer/ap-node-exporter:1.5.0
quay.io/astronomer/ap-prometheus:2.37.5
==========================================================================================
helm template --version 0.33.1 astronomer/astronomer --debug| grep "image: " | awk '{print $2}' | sort -u
==========================================================================================
install.go:178: [debug] Original chart version: "0.33.1"
install.go:195: [debug] CHART PATH: /root/.cache/helm/repository/astronomer-0.33.1.tgz
quay.io/astronomer/ap-alertmanager:0.26.0
quay.io/astronomer/ap-astro-ui:0.33.5
quay.io/astronomer/ap-base:3.18.4
quay.io/astronomer/ap-blackbox-exporter:0.24.0-1
quay.io/astronomer/ap-cli-install:0.26.19
quay.io/astronomer/ap-commander:0.33.4
quay.io/astronomer/ap-configmap-reloader:0.12.0
quay.io/astronomer/ap-curator:8.0.8-3
quay.io/astronomer/ap-db-bootstrapper:0.31.6
quay.io/astronomer/ap-default-backend:0.28.20
quay.io/astronomer/ap-elasticsearch:8.8.2
quay.io/astronomer/ap-elasticsearch-exporter:1.6.0
quay.io/astronomer/ap-fluentd:1.16.2-1
quay.io/astronomer/ap-grafana:10.0.9
quay.io/astronomer/ap-houston-api:0.33.7
quay.io/astronomer/ap-init:3.18.4-1
quay.io/astronomer/ap-kibana:8.8.2
quay.io/astronomer/ap-kube-state:2.8.2
quay.io/astronomer/ap-nats-exporter:0.10.0-6
quay.io/astronomer/ap-nats-server:2.8.4-4
quay.io/astronomer/ap-nats-streaming:0.24.6-4
quay.io/astronomer/ap-nginx:1.9.0-1
quay.io/astronomer/ap-nginx-es:1.25.2-1
quay.io/astronomer/ap-node-exporter:1.6.1
quay.io/astronomer/ap-prometheus:2.45.1
kubectl get pods -n astronomer -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort -u
docker.io/library/postgres:latest
postgres:latest
quay.io/astronomer/ap-alertmanager:0.26.0
quay.io/astronomer/ap-astro-ui:0.33.9
quay.io/astronomer/ap-base:3.18.4-2
quay.io/astronomer/ap-blackbox-exporter:0.24.0-4
quay.io/astronomer/ap-cli-install:0.26.21
quay.io/astronomer/ap-commander:0.33.7
quay.io/astronomer/ap-configmap-reloader:0.12.0
quay.io/astronomer/ap-curator:8.0.8-5
quay.io/astronomer/ap-db-bootstrapper:0.31.7
quay.io/astronomer/ap-db-bootstrapper:0.31.8
quay.io/astronomer/ap-default-backend:0.28.22
quay.io/astronomer/ap-elasticsearch:8.9.2
quay.io/astronomer/ap-elasticsearch-exporter:1.6.0
quay.io/astronomer/ap-grafana:10.0.9
quay.io/astronomer/ap-houston-api:0.33.12
quay.io/astronomer/ap-init:3.18.4-3
quay.io/astronomer/ap-kibana:8.9.2
quay.io/astronomer/ap-kube-state:2.8.2
quay.io/astronomer/ap-nats-exporter:0.12.0-2
quay.io/astronomer/ap-nats-server:2.8.4-4
quay.io/astronomer/ap-nats-streaming:0.24.6-4
quay.io/astronomer/ap-nginx:1.9.4-1
quay.io/astronomer/ap-nginx-es:1.25.2-3
quay.io/astronomer/ap-node-exporter:1.6.1
quay.io/astronomer/ap-prometheus:2.45.1
quay.io/astronomer/ap-registry:3.16.5-1
wget https://helm.astronomer.io/astronomer-0.33.2.tgz
tar -zxvf astronomer-0.33.2.tgz
find /root/astronomer-0.33.2/astronomer -maxdepth 3 -type f -name 'values*' -exec grep -A1 'repository:' {} \; | awk '/repository:/ {printf "%s:", $2} /tag:/ {print $2}'
alpine:3.18
quay.io/astronomer/ap-auth-sidecar:1.25.2-3
~:quay.io/astronomer/ap-pgbouncer-krb:1.17.0-9
quay.io/astronomer/ap-grafana:10.0.9
quay.io/astronomer/ap-db-bootstrapper:0.31.7
quay.io/astronomer/ap-kube-state:2.8.2
quay.io/astronomer/ap-elasticsearch:8.9.2
quay.io/astronomer/ap-base:3.18.4-2
quay.io/astronomer/ap-curator:8.0.8-5
quay.io/astronomer/ap-elasticsearch-exporter:1.6.0
quay.io/astronomer/ap-nginx-es:1.25.2-3
quay.io/astronomer/ap-postgres-exporter:0.15.0-2
quay.io/astronomer/ap-blackbox-exporter:0.24.0-4
quay.io/astronomer/ap-kibana:8.9.2
quay.io/astronomer/ap-init:3.18.4-3
quay.io/astronomer/ap-node-exporter:1.6.1
quay.io/astronomer/ap-alertmanager:0.26.0
astronomer/ap-postgresql:15.4.0-1
bitnami/minideb:stretch
bitnami/postgres-exporter:0.5.1-debian-9-r73
bitnami/postgresql:11.5.0-debian-9-r60
bitnami/minideb:stretch
bitnami/postgres-exporter:0.5.1-debian-9-r73
quay.io/astronomer/ap-fluentd:1.16.2-2
quay.io/astronomer/ap-nginx:1.9.4-1
quay.io/astronomer/ap-default-backend:0.28.22
quay.io/astronomer/ap-commander:0.33.7
quay.io/astronomer/ap-registry:3.16.5-1
quay.io/astronomer/ap-houston-api:0.33.12
quay.io/astronomer/ap-astro-ui:0.33.9
quay.io/astronomer/ap-db-bootstrapper:0.31.8
quay.io/astronomer/ap-cli-install:0.26.21
quay.io/astronomer/ap-prometheus:2.45.1
quay.io/astronomer/ap-configmap-reloader:0.12.0
quay.io/astronomer/ap-nats-server:2.8.4-4
quay.io/astronomer/ap-nats-exporter:0.12.0-2
quay.io/astronomer/ap-init:3.18.4-3
quay.io/astronomer/ap-nats-streaming:0.24.6-4
quay.io/astronomer/ap-nats-exporter:0.12.0-2
quay.io/astronomer/ap-openresty:1.21.4-13
quay.io/astronomer/ap-awsesproxy:1.5.0-4
- If you see the below error, use --set forceIncompatibleKubernetes=true
helm template --version 0.33.2 astronomer/astronomer --debug| grep "image: " | awk '{print $2}' | sort -u
install.go:178: [debug] Original chart version: "0.33.2"
install.go:195: [debug] CHART PATH: /root/.cache/helm/repository/astronomer-0.33.2.tgz
Error: execution error at (astronomer/templates/version_compatibility_check.tpl:9:8): ABORT!
This version of Astronomer "Software" was tested on the following kubernetes versions:
- 1.24.15
- 1.25.11
- 1.26.6
- 1.27.3
- 1.28.0
kubernetes version v1.23.0 is unsupported because it is too old! You must upgrade your kubernetes version before continuing.
For more details, refer to our documentation at https://docs.astronomer.io/software/release-lifecycle-policy
helm.go:84: [debug] execution error at (astronomer/templates/version_compatibility_check.tpl:9:8): ABORT!
This version of Astronomer "Software" was tested on the following kubernetes versions:
- 1.24.15
- 1.25.11
- 1.26.6
- 1.27.3
- 1.28.0
kubernetes version v1.23.0 is unsupported because it is too old! You must upgrade your kubernetes version before continuing.
For more details, refer to our documentation at https://docs.astronomer.io/software/release-lifecycle-policy
helm template --version 0.33.2 astronomer/astronomer --set forceIncompatibleKubernetes=true --debug| grep "image: " | awk '{print $2}' | sort -u
install.go:214: [debug] Original chart version: "0.33.2"
install.go:231: [debug] CHART PATH: /root/.cache/helm/repository/astronomer-0.33.2.tgz
quay.io/astronomer/ap-alertmanager:0.26.0
quay.io/astronomer/ap-astro-ui:0.33.9
quay.io/astronomer/ap-base:3.18.4-2
quay.io/astronomer/ap-blackbox-exporter:0.24.0-4
quay.io/astronomer/ap-cli-install:0.26.21
quay.io/astronomer/ap-commander:0.33.7
quay.io/astronomer/ap-configmap-reloader:0.12.0
quay.io/astronomer/ap-curator:8.0.8-5
quay.io/astronomer/ap-db-bootstrapper:0.31.7
quay.io/astronomer/ap-db-bootstrapper:0.31.8
quay.io/astronomer/ap-default-backend:0.28.22
quay.io/astronomer/ap-elasticsearch:8.9.2
quay.io/astronomer/ap-elasticsearch-exporter:1.6.0
quay.io/astronomer/ap-fluentd:1.16.2-2
quay.io/astronomer/ap-grafana:10.0.9
quay.io/astronomer/ap-houston-api:0.33.12
quay.io/astronomer/ap-init:3.18.4-3
quay.io/astronomer/ap-kibana:8.9.2
quay.io/astronomer/ap-kube-state:2.8.2
quay.io/astronomer/ap-nats-exporter:0.12.0-2
quay.io/astronomer/ap-nats-server:2.8.4-4
quay.io/astronomer/ap-nats-streaming:0.24.6-4
quay.io/astronomer/ap-nginx:1.9.4-1
quay.io/astronomer/ap-nginx-es:1.25.2-3
quay.io/astronomer/ap-node-exporter:1.6.1
quay.io/astronomer/ap-prometheus:2.45.1
Conclusion: Effectively managing and fetching images from your Kubernetes platform is crucial for seamless deployment and application health. By leveraging Helm and kubectl, you can ensure that the right versions are in place, facilitating a smoother workflow in the vast world of Kubernetes deployments, irrespective of the specific application or workload.