无法在kubernetes(AWS)中部署映像

时间:2020-03-18 08:18:09

标签: amazon-web-services kubernetes

我被困在最后一刻,无法找出错误,一切工作正常,但是在群集上部署映像时出现错误:

该图像位于docker hub中,来自aws,我使用docker登录,同时还提供了凭据。

sudo kops validate cluster --state=s3://kops-storage-54321 -o yaml

输出:

Using cluster from kubectl context: tests.k8s.local

nodes:
- hostname: ip-172-20-40-124.us-east-2.compute.internal
  name: ip-172-20-40-124.us-east-2.compute.internal
  role: master
  status: "True"
  zone: us-east-2a
- hostname: ip-172-20-112-165.us-east-2.compute.internal
  name: ip-172-20-112-165.us-east-2.compute.internal
  role: node
  status: "True"
  zone: us-east-2c
- hostname: ip-172-20-60-168.us-east-2.compute.internal
  name: ip-172-20-60-168.us-east-2.compute.internal
  role: node
  status: "True"
  zone: us-east-2a

Docker登录:

sudo docker login

Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /home/ubuntu/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

在部署映像时出现错误:

命令:

ubuntu@ip-172-31-30-176:~$  sudo kubectl create deployment magicalnginx --image=amitranjan007/magicalnginx

错误:

error: no matches for extensions/, Kind=Deployment

1 个答案:

答案 0 :(得分:1)

您可以使用以下方法检查哪些api支持当前的Kubernetes对象:

$ kubectl api-resources | grep deployment
deployments                       deploy       apps                           true         Deployment

这意味着从kubernetes版本1.16开始,只有带有应用程序的apiVersion才是正确的(扩展名不支持Deployment)。

将apiVersion更改为部署Yaml中的apps / v1。