-1

I want to deploy my containers on a raspberry kubernetes cluster.

my yml looks as follows

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 1
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image:   192.168.178.37:5000/my-nginx
        imagePullPolicy: Always
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: my-nginx-service
  labels:
    run: my-nginx
spec:
  type: NodePort 
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30007
  selector:
    run: my-nginx

but I get the following error

Events:
  Type     Reason          Age              From               Message
  ----     ------          ----             ----               -------
  Normal   Scheduled       7s               default-scheduler  Successfully assigned default/my-nginx-7cf6c4949c-dnb6h to node1-pi4
  Normal   Pulling         5s               kubelet            Pulling image "192.168.178.37:5000/my-nginx"
  Warning  Failed          5s               kubelet            Failed to pull image "192.168.178.37:5000/my-nginx": rpc error: code = Unknown desc = Error response from daemon: Get https://192.168.178.37:5000/v2/: http: server gave HTTP response to HTTPS client
  Warning  Failed          5s               kubelet            Error: ErrImagePull
  Normal   SandboxChanged  4s               kubelet            Pod sandbox changed, it will be killed and re-created.
  Normal   BackOff         0s (x3 over 2s)  kubelet            Back-off pulling image "192.168.178.37:5000/my-nginx"
  Warning  Failed          0s (x3 over 2s)  kubelet            Error: ImagePullBackOff
pi@master-pi4 ~/Project/htmlBasic % kubectl restart                                      

I added insecure registries

 % cat /etc/docker/daemon.json
{ "insecure-registries":["192.168.178.37:5000"] }

and I am able to pull from my local registry.

% docker pull 192.168.178.37:5000/my-nginx
Using default tag: latest
latest: Pulling from my-nginx
Digest: sha256:d498979a2da64b098e25938a0ff0dd611959d791f726d6590f671d471aefed05
Status: Image is up to date for 192.168.178.37:5000/my-nginx:latest
192.168.178.37:5000/my-nginx:latest

How do I configure that kubernetes is able to pull from my local registry? I used is set up of kubernetes here

3
  • 1
    Hi A.Dumas, welcome to S.F. Did you make that /etc/docker/daemon.json change on all Nodes in your cluster? And did that sample docker pull you ran take place on the Node in question?
    – mdaniel
    Apr 10, 2021 at 16:37
  • Oh you are right I only did it on the master. Since I do not control the deployment It might be deployed on the other nodes
    – A.Dumas
    Apr 10, 2021 at 16:39
  • @mdaniel: yes I forgot to add this to the worker. you can add as a response and mark it as solution.
    – A.Dumas
    Apr 10, 2021 at 16:44

1 Answer 1

2

You will want to ensure all Nodes in your cluster have that same /etc/docker/daemon.json file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .