0

I'm new to Kubernetes. I was going through my company's training on kubernetes basics. The training was given on mac, but I use a windows pc. Here are the steps I've done so far:

  1. Install docker desktop
  2. Install kubectl
  3. install minikube for windows
  4. Then ran 'minikube start' to create a kubernetes cluster
  5. minikube add node x 2, to add 2 nodes
  6. Then ran kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 to deploy application
  7. Then, checked deployment
kubectl get deployments
NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
kubernetes-bootcamp   0/1     1            0           19m

Ready was 1/1 for the guy giving the demo. He just assumed it would work just fine for everyone and simply moved on. But, I couldn't figure out why it wasn't working for me.

I ran describe deployment and saw this output:

Name:                   kubernetes-bootcamp
Namespace:              default
CreationTimestamp:      Sat, 08 Apr 2023 17:09:09 +0530
Labels:                 app=kubernetes-bootcamp
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=kubernetes-bootcamp
Replicas:               1 desired | 1 updated | 1 total | 0 available | 1 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=kubernetes-bootcamp
  Containers:
   kubernetes-bootcamp:
    Image:        gcr.io/google-samples/kubernetes-bootcamp:v1
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      False   MinimumReplicasUnavailable
  Progressing    False   ProgressDeadlineExceeded
OldReplicaSets:  <none>
NewReplicaSet:   kubernetes-bootcamp-5485cc6795 (1/1 replicas created)
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  23m   deployment-controller  Scaled up replica set kubernetes-bootcamp-5485cc6795 to 1

In this, I noticed under replicas, it was showing 0 available and 1 unavailable. It was showing 1 available and 0 unavailable in the demo.

I saw the pod status was still waiting after a long time. Then I checked the pod and found this:

Events:
  Type     Reason                  Age                 From               Message
  ----     ------                  ----                ----               -------
  Normal   Scheduled               44m                 default-scheduler  Successfully assigned default/kubernetes-bootcamp-5485cc6795-pzfc9 to minikube-m03
  Warning  FailedCreatePodSandBox  44m                 kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "b90ef79bb9eaffa1dda9ea484746df3ffe16b73e856f19219706ee23d5927204" network for pod "kubernetes-bootcamp-5485cc6795-pzfc9": networkPlugin cni failed to set up pod "kubernetes-bootcamp-5485cc6795-pzfc9_default" network: plugin type="loopback" failed (add): missing network name:, failed to clean up sandbox container "b90ef79bb9eaffa1dda9ea484746df3ffe16b73e856f19219706ee23d5927204" network for pod "kubernetes-bootcamp-5485cc6795-pzfc9": networkPlugin cni failed to teardown pod "kubernetes-bootcamp-5485cc6795-pzfc9_default" network: plugin type="loopback" failed (delete): missing network name]
  Normal   SandboxChanged          34m (x47 over 44m)  kubelet            Pod sandbox changed, it will be killed and re-created.

In the warning, it says 'cni failed to setup pod' and then something about 'missing network name'. I searched incessantly on the web regarding this, but was not getting a complete match. Many people reported the same problem of 'Failed to create sandbox', but their reason is different. I'm not sure what is wrong with the steps above. Please help me understand this error.

rock'n rolla
  • 1,883
  • 1
  • 13
  • 19

0 Answers0