Tuesday, 25 June 2024

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ...

For a deployment, we can do this: -

kubectl get deployment foobar --namespace snafu --output jsonpath="{..image}"

which returns the image name(s) on the same line

Or we can do this: -

kubectl get deployment foobar --namespace snafu --output JSON | jq -r '.spec.template.spec.containers[].image'

which does much the same, although with each image on a separate line 'cos formatting

Alternatively, we can examine the pod: -

kubectl get pods --namespace snafu --selector app=foobar --output jsonpath="{..image}"

which, again, returns the image(s) on the same line, but for each pod in the deployment - which perhaps leads to duplication

For me, kubectl get deployment is simpler ...

Friday, 14 June 2024

Lest I forget - how to install pip on Ubuntu

 I seem to forget to remember this almost monthly, every time I spin up a new Ubuntu VM

This time around, it's Ubuntu 22.04 and I'm trying to install python3-pip ( aka pip3 or just pip )

apt-get install -y python3-pip

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3-pip' has no installation candidate

Ah, of course, it's sources.list as ever ...

cat <<EOF >> /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu jammy universe
deb http://us.archive.ubuntu.com/ubuntu jammy-updates universe
EOF

and now apt-get install -y python3-pip is happy
 

ls -al $(which pip)

-rwxr-xr-x 1 root root 221 Nov 10  2023 /usr/bin/pip

ls -al $(which pip3)

-rwxr-xr-x 1 root root 221 Nov 10  2023 /usr/bin/pip3

Saturday, 17 February 2024

Visual Studio Code - Wow πŸ™€

Why did I not know that I can merely hit [cmd] [p] to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub etc. for a file name ?



How long have I spent manually navigating the folder structure on the left-hand side ?

πŸ™€πŸ™€πŸ™€

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...