User Tools

Site Tools


de:sysadmin:tools:k8s_und_docker_images

kubernetes & docker images

docker images lokal erzeugen und nach minikube pushen

getestet unter: Linux, bash, minikube 1.11 und docker api version 1.40 (2020-07)

Minikube Environment in die Shell "laden"

$ eval $(minikube -p minikube docker-env)

prüfen, ob wir in der Minikube-Docker-Umgebung sind

$ echo $MINIKUBE_ACTIVE_DOCKERD
minikube

docker-Image bauen

$ docker build -t my-local-image MyLocalImageDIR

prüfen, ob das image "im store" ist:

$ docker images | grep mv-local-image

Zum Testen einen Pod direkt starten

$ kubectl run test1 --image=my-local-image --image-pull-policy=IfNotPresent
$ kubectl describe pod test1 | tail
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  93s   default-scheduler  Successfully assigned default/test1 to minikube
  Normal  Pulled     92s   kubelet, minikube  Container image "my-local-image" already present on machine
  Normal  Created    92s   kubelet, minikube  Created container test1
  Normal  Started    92s   kubelet, minikube  Started container test1 

Lokales Image in Deployment (oder StatefulSet) einbauen

    [...]
    spec:
      containers:
      - name: main
        image: my-local-image
        imagePullPolicy: IfNotPresent
    [...]
de/sysadmin/tools/k8s_und_docker_images.txt · Last modified: 2022-06-25 09:25 by hella

Page Tools

Mastodon Twitter