Kubernetes Statefulset: cannot join network of a non running container

11/10/2017

I am trying to experiment with Statefulset template and the below spec (similar) works fine with hostNetwork: true and I am able to bring up two pods on each nodes, but when I remove it I get the error: rpc error: code = 2 desc = failed to start container "a9fe503a2fe76e1207ffe1a9267e324341383562927b800c93bde7443906c727": Error response from daemon: {"message":"cannot join network of a non running container: de6427d704d7fb7e48e344bc6ce31e218d9d30e2902 7c03f29674015fb3cc668"}

The yml spec:

apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: abc
spec:
  serviceName: abc
  replicas: 2
  template:
    metadata:
      labels:
        app: abc
    spec:
      #hostNetwork: true
      terminationGracePeriodSeconds: 10
      containers:
      - name: abc
        image: abc.xyz.com:9001/abc:01.00.00.00
        ports:
        - name: api-port
          containerPort: 9000
          hostPort: 9000
        readinessProbe:
          httpGet:
            path: /api
            port: api-port
            scheme: HTTPS

What could be the reason for this issue? Other similar threads are suggesting to install a pod network but I am already using flannel, and as I mentioned with hostNetwork:true everything works fine. What more can I look into to understand the problem?

-- lex
kubernetes

1 Answer

11/14/2017

I don't know the exact reason why I was running into the problem, but changing the pod network from flannel to weave solved the issue.

-- lex
Source: StackOverflow