容器在GKE上部署失败

huangapple go评论90阅读模式
英文:

Container Failing to deploy on GKE

问题

我有一个用Go语言编写的容器。它可以在我的DockerDesktop上部署和运行,也可以在我的Kubernetes集群中的DockerDesktop上运行。

我已经将相同的容器推送到了Artifact Repository,但无法部署。

所以我将它部署到了CloudRun上,它可以正常工作!非常困惑。

我的GKE集群是自动驾驶模式,所以我认为没有资源问题。

我期望能够获得一个正在运行的容器,但实际上我得到的是:

无法调度Pod:CPU不足。
PodUnschedulable
原因
无法调度Pod:CPU不足。
了解更多
来源
gmail-sender-7944d6d4d4-tsdt9
gmail-sender-7944d6d4d4-pc9xp
gmail-sender-7944d6d4d4-kdlds
PodUnschedulable 无法调度Pod:内存不足。

我的部署文件如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: gmail-sender
  labels:
    app: gmail-sender
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gmail-sender
  template:
    metadata:
      labels:
        app: gmail-sender
    spec:
      containers:
        - name: gmail-sender
          image: europe-west2-docker.pkg.dev/ea-website-359514/gmail-sender/gmail-sender:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8099
---
apiVersion: v1
kind: Service
metadata:
  name: gmail-sender-cluster-ip
  labels:
    app: gmail-sender
spec:
  ports:
    - port: 8099
      protocol: TCP
英文:

I have a container written in go. It deploys and runs on my DockerDesktop & on my Kubernetes cluster in DockerDesktop.

I have pushed the same container to Artefact Repository and it fails to deploy.

So I deployed it to CloudRun, and it works! Very confused.

My GKE cluster is autopilot so I assume the are no resource issues.

I expected to get a running container however i got

Cannot schedule pods: Insufficient cpu.
PodUnschedulable
Reason
Cannot schedule pods: Insufficient cpu.
Learn more
Source
gmail-sender-7944d6d4d4-tsdt9
gmail-sender-7944d6d4d4-pc9xp
gmail-sender-7944d6d4d4-kdlds
PodUnschedulable Cannot schedule pods: Insufficient memory.

My deployment file is as follows

apiVersion: apps/v1
kind: Deployment
metadata:
  name: gmail-sender
  labels:
    app: gmail-sender
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gmail-sender
  template:
    metadata:
      labels:
        app: gmail-sender
    spec:
      containers:
        - name: gmail-sender
          image: europe-west2-docker.pkg.dev/ea-website-359514/gmail-sender/gmail-sender:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8099
---
apiVersion: v1
kind: Service
metadata:
  name: gmail-sender-cluster-ip
  labels:
    app: gmail-sender
spec:
  ports:
    - port: 8099
      protocol: TCP

答案1

得分: 1

根据错误信息,很明显节点的内存和CPU不足以安排/运行工作负载。请检查节点配置,并确保节点上有足够的资源来承载工作负载。

无法调度Pod:CPU不足。
PodUnschedulable原因:无法调度Pod:CPU不足。

了解更多来源:gmail-sender-7944d6d4d4-tsdt9
gmail-sender-7944d6d4d4-pc9xp gmail-sender-7944d6d4d4-kdlds PodUnschedulable
无法调度Pod:内存不足。
英文:

Looking at the error it is clear that node doesnt have sufficient memory and cpu to schedule/run the workload. Check the node configuration and ensure that resources are available on the node to host the workload

Cannot schedule pods: Insufficient cpu. 
PodUnschedulable Reason Cannot schedule pods: Insufficient cpu. 

Learn more Source gmail-sender-7944d6d4d4-tsdt9 
gmail-sender-7944d6d4d4-pc9xp gmail-sender-7944d6d4d4-kdlds PodUnschedulable 
Cannot schedule pods: Insufficient memory.

huangapple
  • 本文由 发表于 2022年11月2日 03:58:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/74281180.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定