Home>

I want to create a container from a local container image with kubenetes

I did kubectl apply -f deployments.yaml (deployment.apps/testbot created), but when I ran kubectl get pod

NAME READY STATUS RESTARTS AGE
testbot-5df8f64fc6-7bgvq 0/1 ErrImageNeverPull 0 7s


I got out and could not start normally.

Corresponding source code
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bot
spec: spec:
  replicas: 1
  selector:
    matchLabels:
      app: bot
  template:
    metadata:
      labels: labels:
        app: bot
    spec: spec:
      containers: containers:
      --image: testbot: bot
        name: bot
        imagePullPolicy: Never
What I tried

docker build --tag testbot: bot ..Was executed
kubectl apply -f deployments.yamlWas executed

Supplementary information (FW/tool version, etc.)

Ubuntu 20.04.1 LTS
Docker version 19.03.8
Kubernetes v1.19.1

  • Answer # 1

    Where is your Kubernetes built? The container runtime on the scheduled node must have that image, so if you're using something other than the minikubenone driver or kind, you'll want to do docker pull/crictl pull from that node.