Score:0

Pod in ReplicaSet only 1 is ready

id flag

I'm using K3S (debian 10) and I'm super noob for kuber.

Here is the issue:

server:~# kubectl get pod 
NAME                  READY   STATUS    RESTARTS   AGE
vlmcsd-server-q4vfv   1/1     Running   0          15m
vlmcsd-server-b6qmk   0/1     Pending   0          3s
vlmcsd-server-tvsnr   0/1     Pending   0          3s
vlmcsd-server-lg6gw   0/1     Pending   0          3s

Here is the k8file:

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: vlmcsd-server
spec:
  replicas: 4
  selector:
    matchLabels:
      role: server

  template:
    metadata:
      labels:
        role: server
    spec:
      containers:
      - name: vlmcsd-1
        image: mikolatero/vlmcsd
        ports:
          - name: service-vlmcsd
            containerPort: 1688
            hostPort: 1688
            protocol: TCP  

So, Why only one pod is READY? As far as I can guess, port conflict? And is that mean ports name containerPort hostPort is direct port mapping rather SLB or something?

If it's port conflict, Which networking should I use?

server:~# kubectl describe pod/vlmcsd-server-q4vfv
Name:         vlmcsd-server-q4vfv
Namespace:    default
Priority:     0
Node:         tower.rczhiyun.local/10.188.180.251
Start Time:   Fri, 06 Aug 2021 14:50:44 +0800
Labels:       role=server
Annotations:  <none>
Status:       Running
IP:           10.42.0.21
IPs:
  IP:           10.42.0.21
Controlled By:  ReplicaSet/vlmcsd-server
Containers:
  vlmcsd-1:
    Container ID:   containerd://f45628cff396ae95a0678c4c5d8160ef83e068f5fbdf2b76f7528404644e588a
    Image:          mikolatero/vlmcsd
    Image ID:       docker.io/mikolatero/vlmcsd@sha256:d4eb626c762780fa37ecdb4e3efabb666b7dbf8355dfebc874e21ba780e3803c
    Port:           1688/TCP
    Host Port:      1688/TCP
    State:          Running
      Started:      Fri, 06 Aug 2021 14:50:47 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-n77c5 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-n77c5:
    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
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  21m   default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.
  Warning  FailedScheduling  21m   default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.
  Normal   Scheduled         21m   default-scheduler  Successfully assigned default/vlmcsd-server-q4vfv to tower.rczhiyun.local
  Normal   Pulling           21m   kubelet            Pulling image "mikolatero/vlmcsd"
  Normal   Pulled            21m   kubelet            Successfully pulled image "mikolatero/vlmcsd" in 2.377603969s
  Normal   Created           21m   kubelet            Created container vlmcsd-1
  Normal   Started           21m   kubelet            Started container vlmcsd-1
server:~# kubectl describe pod/vlmcsd-server-b6qmk
Name:           vlmcsd-server-b6qmk
Namespace:      default
Priority:       0
Node:           <none>
Labels:         role=server
Annotations:    <none>
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  ReplicaSet/vlmcsd-server
Containers:
  vlmcsd-1:
    Image:        mikolatero/vlmcsd
    Port:         1688/TCP
    Host Port:    1688/TCP
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ztdjn (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  kube-api-access-ztdjn:
    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
  ----     ------            ----   ----               -------
  Warning  FailedScheduling  6m22s  default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.
  Warning  FailedScheduling  6m20s  default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.

Wytrzymały Wiktor avatar
it flag
Hello @Alceatraz and welcome to ServerFault! This error comes from kubernetes scheduler but before we dig deeper, could you please tell me why are you using a `ReplicaSet` instead of a `Deployment`?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.