Knative服务部署失败,原因为RevisionMissing



我已经在Knative上部署了一项服务。我对服务代码/Docker映像进行了迭代,并尝试在同一地址重新部署它。我按照以下步骤进行:

  1. 在我们的私人Docker repo上推送了新的Docker镜像
  2. 更新了服务YAML文件以指向新的Docker映像(请参阅下面的YAML)
  3. 使用命令删除服务:kubectl -n myspacename delete -f myservicename.yaml
  4. 使用以下命令重新创建服务:kubectl -n myspacename apply -f myservicename.yaml

在部署期间,服务显示READY=Unknown和REASON=RevisionMissing,过一段时间后,显示READY=False和REASON=ProgressDeadlineExceeded。当使用以下命令kubectl -n myspacename logs revision.serving.knative.dev/myservicename-00001查看pod的日志时,我得到消息:

没有种类"修订版";已注册版本";服务于.knative.dev/v1";在方案"中;pkg/scheme/scheme.go:28";

这是服务的YAML文件:

---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: myservicename
namespace: myspacename
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
autoscaling.knative.dev/metric: concurrency
autoscaling.knative.dev/target: '1'
autoscaling.knative.dev/minScale: '0'
autoscaling.knative.dev/maxScale: '5'
autoscaling.knative.dev/scaleDownDelay: 60s
autoscaling.knative.dev/window: 600s
spec:
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
volumes:
- name: nfs-volume
persistentVolumeClaim:
claimName: myspacename-models-pvc
imagePullSecrets:
- name: myrobotaccount-pull-secret
containers:
- name: myservicename
image: quay.company.com/project/myservicename:0.4.0
ports:
- containerPort: 5000
name: user-port
protocol: TCP
resources:
limits:
cpu: "4"
memory: 36Gi
nvidia.com/gpu: 1
requests:
cpu: "2"
memory: 32Gi
volumeMounts:
- name: nfs-volume
mountPath: /tmp/static/
securityContext:
privileged: true
env:
- name: CLOUD_STORAGE_PASSWORD
valueFrom:
secretKeyRef:
name: myservicename-cloud-storage-password
key: key
envFrom:
- configMapRef:
name: myservicename-config

我上面遵循的协议是正确的,问题是因为Knative正在服务的Docker映像的代码中存在错误。我能够通过查看pod的日志来解决这个问题,如下所示:

首先运行以下命令以获取pod名称:kubectl -n myspacename get pods。吊舱名称示例=myservicename-00001-deployment-56595b764f-dl7x6

然后使用以下命令获取pod的日志:kubectl -n myspacename logs myservicename-00001-deployment-56595b764f-dl7x6

相关内容

  • 没有找到相关文章

最新更新