Sprinboot application is pending in kubernetes

4/25/2019

I have a springboot application using a container docker, its work, but now I want run in a kubernetes cluster. I push this container in dockerhub and work yet

I create 2 files

I'm using this tutorial https://learnk8s.io/blog/scaling-spring-boot-microservices/ but without minikube, I have 3 servers in my company

[webapp@srvapih controle-acesso-api]$ ll
total 8
-rw-rw-r--. 1 webapp webapp 433 Abr 25 08:19 cta-deployment.yaml
-rw-rw-r--. 1 webapp webapp 163 Abr 25 08:18 cta-service.ymal

cta-deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: controle-acesso-api
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: controle-acesso-api
    spec:
      containers:
        - name: api
          image: xxxx/controleacesso-api
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8080
          resources:
            limits:
              memory: 128Mi

cta-service.ymal

apiVersion: v1
kind: Service
metadata:
  name: controle-acesso-api
spec:
  ports:
    - port: 8080
      targetPort: 8080
  selector:
    app: controle-acesso-api

I execute this commands

[webapp@srvapih controle-acesso-api]$ kubectl create -f cta-deployment.yaml 
deployment.extensions/controle-acesso-api created
[webapp@srvapih controle-acesso-api]$ kubectl create -f cta-service.ymal 
service/controle-acesso-api created

[webapp@srvapih controle-acesso-api]$ kubectl get pods -l=app=controle-acesso-api
NAME                                   READY   STATUS    RESTARTS   AGE
controle-acesso-api-5898c87db6-bxks9   0/1     Pending   0          20s
[webapp@srvapih controle-acesso-api]$ kubectl get all
NAME                                       READY   STATUS    RESTARTS   AGE
pod/controle-acesso-api-5898c87db6-bxks9   0/1     Pending   0          2m50s

NAME                          TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/controle-acesso-api   ClusterIP   10.100.155.84   <none>        8080/TCP   2m42s
service/kubernetes            ClusterIP   10.96.0.1       <none>        443/TCP    6d17h

NAME                                  READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/controle-acesso-api   0/1     1            0           2m50s

NAME                                             DESIRED   CURRENT   READY   AGE
replicaset.apps/controle-acesso-api-5898c87db6   1         1         0       2m50s

describing pod

[webapp@srvapih controle-acesso-api]$ kubectl describe pods controle-acesso-api-5898c87db6-bxks9
Name:               controle-acesso-api-5898c87db6-bxks9
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               <none>
Labels:             app=controle-acesso-api
                    pod-template-hash=5898c87db6
Annotations:        <none>
Status:             Pending
IP:                 
Controlled By:      ReplicaSet/controle-acesso-api-5898c87db6
Containers:
  api:
    Image:      beirario/controle-acesso-api
    Port:       8080/TCP
    Host Port:  0/TCP
    Limits:
      memory:  128Mi
    Requests:
      memory:     128Mi
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-xdqpp (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  default-token-xdqpp:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-xdqpp
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  95s (x27 over 14m)  default-scheduler  0/3 nodes are available: 3 node(s) had taints that the pod didn't tolerate.

Is stranged because my nodes are NotReady status

[webapp@srvapih controle-acesso-api]$ kubectl get nodes
NAME                STATUS     ROLES    AGE     VERSION
srvapi2h.intranet   NotReady   <none>   6d17h   v1.13.4
srvapi3h.intranet   NotReady   <none>   6d17h   v1.13.4
srvapih.intranet    NotReady   master   6d17h   v1.13.4
-- Felipe Flores
docker
kubernetes
spring-boot

0 Answers