Skip to content

Kubernetes and Docker

Contribution by Arco van Geest

Warning

This page is under heavy construction. Use at your own risk!

Docker

This is not needed for kubernetes but a lot of container development is still done with docker and docker-compose.

Containers

When a container is created with defaults it gets a name like nifty_fermat.

# only show running containers
$ docker ps
# only show all containers
$ docker ps -a
# remove containers
$ docker rm gifted_haibt friendly_curran

Images

# show images
$ docker images

<none> are old images where the tag has been reused for a new image.

# remove images by name or by id (that are not used in a container)
$ docker rmi testimage
$ docker rmi 76a9ddbe28e2
# remove all dangling images (DANGER!)
$docker images --filter "dangling=true" -q --no-trunc

Docker testing

System updates

Better stop the docker engine before applying updates. Sometimes containers stop working

Podman/Buildah

On newer RHEL like systems docker has been replaced by podman. In most cases it’s enough to replace the docker command by podman, e.g. podman ps

Kubernetes

Clients

Openshift Client (oc)

When installing the openshift client (OC) kubectl is also installed.

Choose openid-keycloak to connect, not kube:admin. The link can be found at “Help→Command Line Tools”

Get kubeconfig

$ export KUBECONFIG=~/.kube/openshiftconfig
$ oc login --token=TOKEN --server=https://api.ocp4.k8s.tudelft.nl:443
$ cat ~/.kube/openshiftconfig

Kubernetes control (kubectl)

Helm

Helm is very version strict. At least the Helm 2 versions. Helm 2 needs a lot of rights. Helm 3 is better to use as a non-admin user.

  1. untested

Kubernetes testing

run ad-hoc pods
port forward

Namespaces

create
non-root
context
    warning
unique
    naming convention

Storage

Backups

Backups are created with velero.

annotation
    pod/deployment

Ingress

Retrieved from https://wiki.tudelft.ninja/index.phptitle=KubernetesUserInfo&oldid=317

Kubernetes userdoc Mindmap

Kubernetes userdoc Mindmap