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

Reminder - installing podman and skopeo on Ubuntu 22.04

This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman  and skopeo  on an Ubuntu box: - lsb_rel...