简体   繁体   中英

Equivalent of kind load or minikube cache in kubeadm

I have 3 nodes kubernetes cluster managing with kubeadm. Previously i used kind and minikube. When I wanted make deployment based on docker image i just need make:

  • kind load docker-image in kind or,
  • minikube cache add in minikube,

Now, when I want make deployment in kubeadm I obviously get ImagePullBackOff. Question: Is a equivalent comment do add image to kubeadm and I can't find it, or there is entirely other way to solve that problem?

EDIT

Maybe, question is not clear enough, so instead of delete it I try to put more details.

I have tree nodes (one control plane, and two workers) with docker, kubeadm, kubelet and kubectl installed on each. One deployment of my future cluster is machine learning module so I need tensorflow:

docker pull tensorflow/tensorflow

Using this image I build my own:

docker build -t mlimage:cluster -f ml.Dockerfile .

Next I prepare deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mldeployment
spec:
  selector:
    matchLabels:
      app: mldeployment
      name: mldeployment
  replicas: 1
  template:
    metadata:
      labels:
        app: mldeployment
        name: mldeployment
    spec:
      containers:
      - name: mlcontainer
        image: mlimage:cluster
        imagePullPolicy: Never
        ports:
        - name: http
          containerPort: 6060

and create it:

kubectl create -f mldeployment.yaml

Now, when I type

kubectl describe pod

In mldeployment are these events:

在此处输入图像描述

In that case of minikube or kind it was enought to simply add image to cluster typing

minikibe cache add ...

and

kind load docker-image ...

respectively.

Question is how to add image from my machine to cluster in case of managing it from kubeadm. I assume that there is similar way to do that like for minikube or kind (without creating any connection to docker hub, because everything is locally).

you are getting ImagePullBackOff due to kubeadm maybe going to check inside the registry.

while if you look at both command minikube cache and kind load is for loading the local images into the cluster.

As I now understand images for cluster managed via kubeadm should be stored in trusted registry like dockerhub or cloud. But if you want make fast solution in separated networks there is a posibility: Docker registry . There are also some tools ready to use eg Trow , or simpler solution . I used second approach, and it works (code is a bit old, so it may needs some changes, this links may be helpful: change apiVersion , add label

After that changes, first create deployment and daemonSet:

kubectl create -f docker-private-registry.json
kubectl create -f docker-private-registry-proxy.json

Add localhost address to image:

docker tag image:tag 127.0.0.1:5000/image:tag

Check full name of docker private registry deployment, and forward port (replace x by exact deployment name:

kubectl get pod
kubectl port-forward docker-private-registry-deployment-xxxxxxxxx-xxxxx 5000:5000 -n default

Open next terminal window and push image to private registry:

docker push 127.0.0.1:5000/image:tag

Finnaly change in deployment.yaml file containers image (add 127.0.0.1:5000/...) and create deployment.

This solution is very unsafe and vulnerable, so use it wisely only in separated networks for test and dev purposes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM