unable to deploy local container image to k8s cluster

381 views Asked by At

I have tried to deploy one of the local container images I created but keeps always getting the below error

Failed to pull image "webrole1:dev": rpc error: code = Unknown desc = Error response from daemon: pull access denied for webrole1, repository does not exist or may require 'docker login': denied: requested access to

I have followed the below article to containerize my application and I was able to successfully complete this but when I try to deploy it to k8s pod I don't succeed

My pod.yaml looks like below

apiVersion: v1
kind: Pod
metadata:
  name: learnk8s
spec:
  containers:
  - name: webrole1dev
    image: 'webrole1:dev'
    ports:
      - containerPort: 8080

and below are some images from my PowerShell

enter image description here

enter image description here

enter image description here

I am new to dockers and k8s so thanks for the help in advance and would appreciate if I get some detailed response.

1

There are 1 answers

2
coderanger On

When you're working locally, you can use an image name like webrole, however that doesn't tell Docker where the image came from (because it didn't come from anywhere, you built it locally). When you start working with multiple hosts, you need to push things to a Docker registry. For local Kubernetes experiments you can also change your config so you build your image in the same Docker environment as Kubernetes is using, though the specifics of that depend on how you set up both Docker and Kubernetes.