title: Back-off restarting failed container while creating a redis deployment in k8s
body: <p>I am trying to launch a deployment object in k8s with kubernetes/redis image. But I am getting   error <strong>Back-off restarting failed container</strong>. The issue occurs with just <strong>redis</strong> image and I am able to successfully run deployments with postgres image etc.</p>
  
  <p>Here is the config file:</p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: redis-deployment
  spec:
    replicas: 1
    selector:
      matchLabels:
        component: redis
    template:
      metadata:
        labels:
          component: redis
      spec: 
        containers:
          - name: redis
            image: kubernetes/redis
            ports:
              - containerPort: 6379
  </code></pre>
  
  <p>Describe pod output:</p>
  
  <pre><code>Name:               redis-deployment-57dcf8ff69-9v8sz
  Namespace:          default
  Priority:           0
  PriorityClassName:  &lt;none&gt;
  Node:               minikube/10.0.2.15
  Start Time:         Sun, 10 Mar 2019 11:13:00 +0530
  Labels:             component=redis
                      pod-template-hash=57dcf8ff69
  Annotations:        &lt;none&gt;
  Status:             Running
  IP:                 172.17.0.8
  Controlled By:      ReplicaSet/redis-deployment-57dcf8ff69
  Containers:
    redis:
      Container ID:   docker://556544175a99da6cd704ddc5ae6e65ee0a424275872d86543bbfef6eebceff5b
      Image:          kubernetes/redis
      Image ID:       docker-pullable://kubernetes/redis@sha256:60e8254f473b1df64340da257e8e0a029c0ac67a76bdde296f11eba6cde515c7
      Port:           6379/TCP
      State:          Waiting
        Reason:       CrashLoopBackOff
      Last State:     Terminated
        Reason:       Error
        Exit Code:    1
        Started:      Sun, 10 Mar 2019 20:12:26 +0530
        Finished:     Sun, 10 Mar 2019 20:13:28 +0530
      Ready:          False
      Restart Count:  13
      Environment:    &lt;none&gt;
      Mounts:
        /var/run/secrets/kubernetes.io/serviceaccount from default-token-zqj5b (ro)
  Conditions:
    Type              Status
    Initialized       True
    Ready             False
    ContainersReady   False
    PodScheduled      True
  Volumes:
    default-token-zqj5b:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  default-token-zqj5b
      Optional:    false
  QoS Class:       BestEffort
  Node-Selectors:  &lt;none&gt;
  Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                   node.kubernetes.io/unreachable:NoExecute for 300s
  Events:
    Type     Reason          Age                From               Message
    ----     ------          ----               ----               -------
    Normal   Scheduled       9h                 default-scheduler  Successfully assigned default/redis-deployment-57dcf8ff69-9v8sz to minikube
    Normal   Pulling         5h (x5 over 9h)    kubelet, minikube  pulling image "kubernetes/redis"
    Normal   Pulled          5h (x5 over 5h)    kubelet, minikube  Successfully pulled image "kubernetes/redis"
    Normal   Created         5h (x5 over 5h)    kubelet, minikube  Created container
    Normal   Started         5h (x5 over 5h)    kubelet, minikube  Started container
    Warning  BackOff         5h (x53 over 5h)   kubelet, minikube  Back-off restarting failed container
    Normal   SandboxChanged  17m                kubelet, minikube  Pod sandbox changed, it will be killed and re-created.
    Normal   Pulling         11m (x4 over 16m)  kubelet, minikube  pulling image "kubernetes/redis"
    Normal   Pulled          11m (x4 over 16m)  kubelet, minikube  Successfully pulled image "kubernetes/redis"
    Normal   Created         11m (x4 over 16m)  kubelet, minikube  Created container
    Normal   Started         11m (x4 over 16m)  kubelet, minikube  Started container
    Warning  BackOff         1m (x39 over 15m)  kubelet, minikube  Back-off restarting failed container
  </code></pre>
  
  <p>I am using the <strong>kubernetes/redis</strong> image in this example as using <strong>redis</strong> image completely fails because kubectl is not able to get the image pulled from dockerhub and I get the error which says failed in pulling the image. Not sure why !</p>
  
  <p>Can anyone please help me out here.</p>
  
  <p>EDIT---</p>
  
  <p>Logs</p>
  
  <pre><code>kubectl.exe logs redis-deployment-57dcf8ff69-9v8sz
  Could not connect to Redis at -p:6379: Name or service not known
  Failed to find master.
  </code></pre>