skip to Main Content

I’m following Les Jackson’s tutorial to microservices and got stuck at 05:30:00 while creating a deployment for a ms sql server. I’ve written the deployment file just as shown on the yt video:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mssql-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mssql
  template:
    metadata:
      labels:
        app: mssql
    spec:
      containers:
        - name: mssql
          image: mcr.microsoft.com/mssql/server:2017-latest
          ports:
            - containerPort: 1433
          env:
          - name: MSSQL_PID
            value: "Express"
          - name: ACCEPT_EULA
            value: "Y"
          - name: SA_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mssql
                key: SA_PASSWORD
          volumeMounts:
            - mountPath: /var/opt/mssql/data
              name: mssqldb
      volumes:
      - name: mssqldb
        persistentVolumeClaim:
          claimName: mssql-claim

---
apiVersion: v1
kind: Service
metadata:
  name: mssql-clusterip-srv
spec:
  type: ClusterIP
  selector:
    app: mssql
  ports:
  - name: mssql
    protocol: TCP
    port: 1433 # this is default port for mssql
    targetPort: 1433 

---
apiVersion: v1
kind: Service
metadata:
  name: mssql-loadbalancer
spec:
  type: LoadBalancer
  selector:
    app: mssql
  ports:
  - protocol: TCP
    port: 1433 # this is default port for mssql
   targetPort: 1433 

The persistent volume claim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mssql-claim
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 200Mi

But when I apply this deployment, the pod ends up with ImagePullBackOff status:

commands-depl-688f77b9c6-vln5v    1/1     Running            0          2d21h
mssql-depl-5cd6d7d486-m8nw6       0/1     ImagePullBackOff   0          4m54s
platforms-depl-6b6cf9b478-ktlhf   1/1     Running            0          2d21h

kubectl describe pod

Name:         mssql-depl-5cd6d7d486-nrrkn
Namespace:    default
Priority:     0
Node:         docker-desktop/192.168.65.4
Start Time:   Thu, 28 Jul 2022 12:09:34 +0200
Labels:       app=mssql
              pod-template-hash=5cd6d7d486
Annotations:  <none>
Status:       Pending
IP:           10.1.0.27
IPs:
  IP:           10.1.0.27
Controlled By:  ReplicaSet/mssql-depl-5cd6d7d486
Containers:
  mssql:
    Container ID:
    Image:          mcr.microsoft.com/mssql/server:2017-latest
    Image ID:
    Port:           1433/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:
      MSSQL_PID:    Express
      ACCEPT_EULA:  Y
      SA_PASSWORD:  <set to the key 'SA_PASSWORD' in secret         'mssql'>  Optional: false
    Mounts:
      /var/opt/mssql/data from mssqldb (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-    api-access-xqzks (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  mssqldb:
    Type:       PersistentVolumeClaim (a reference to a         PersistentVolumeClaim in the same namespace)
    ClaimName:  mssql-claim
    ReadOnly:   false
  kube-api-access-xqzks:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-    ready:NoExecute op=Exists for 300s
                                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  3m42s                default-scheduler      Successfully assigned default/mssql-depl-5cd6d7d486-nrrkn to docker-desktop
  Warning  Failed     102s                 kubelet                Failed to pull image "mcr.microsoft.com/mssql/server:2017-latest":     rpc error: code = Unknown desc = context deadline exceeded
  Warning  Failed     102s                 kubelet            Error: ErrImagePull
  Normal   BackOff    102s                 kubelet            Back-off pulling image "mcr.microsoft.com/mssql/server:2017-latest"
  Warning  Failed     102s                 kubelet            Error: ImagePullBackOff
  Normal   Pulling    87s (x2 over 3m41s)  kubelet            Pulling image "mcr.microsoft.com/mssql/server:2017-latest"

In the events it shows

"rpc error: code = Unknown desc = context deadline exceeded"

But it doesn’t tell me anything and resources on troubleshooting this error don’t include such error.

I’m using kubernetes on docker locally.
I’ve researched that this issue can happen when pulling the image from a private registry, but this is public one, right here. I copy pasted the image path to be sure, I tried with different ms sql version, but to no avail.

Can someone be so kind and show me the right direction I should go / what should I try to get this to work? It worked just fine on the video 🙁

2

Answers


  1. Chosen as BEST ANSWER

    I fixed it by manually pulling the image via docker pull mcr.microsoft.com/mssql/server:2017-latest and then deleting and re-applying the deployment.


  2. I my case, I needed to pull the image "to minikube" using minikube ssh docker pull <the_image>

    Then I can apply my deployment without errors.

    Source: https://github.com/kubernetes/minikube/issues/14806

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search