我在尝试运行几个nginx吊舱时遇到了一些不推荐的错误
bash-4.4$ kubectl run nginx --image=nginx --port=80 --replicas=3
WARNING: New generator "deployment/apps.v1beta1" specified, but it isn't available. Falling back to "deployment/v1beta1".
kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead.
error: no matches for kind "Deployment" in version "apps/v1beta1"在尝试添加应用程序生成器时,我也遇到了一个障碍.
bash-4.4$ kubectl run nginx --image=nginx --port=80 --replicas=3 --generator=deployment/apps.v1beta1
kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead.
error: no matches for kind "Deployment" in version "apps/v1beta1"不太确定是怎么回事,我只是在尝试一个简单的hello世界,下面是部署和公开的剧本
---
#######################################
# Deploy and expose Nginx service
#######################################
# Expects kubectl being configured on the local machine
# using kubectl.yml playbook
- hosts: localhost
connection: local
tasks:
- name: Launch 3 nginx pods
command: "kubectl run nginx --image=nginx --port=80 --replicas=3"
# command: "kubectl create deployment nginx --image=nginx --generator=deployment-basic/v1beta1"
- name: Expose nginx
command: "kubectl expose deployment nginx --type NodePort"
- name: Get exposed port
command: "kubectl get svc nginx --output=jsonpath='{range .spec.ports[0]}{.nodePort}'"
register: result
- set_fact:
node_port: "{{ result.stdout }}"
- debug: msg="Exposed port {{ node_port }}"下面是集群和版本的一些背景信息等等。
bash-4.4$ kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.2", GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740", GitTreeState:"clean", BuildDate:"2018-10-30T21:39:38Z", GoVersion:"go1.11.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.6", GitCommit:"ae4550cc9c89a593bcda6678df201db1b208133b", GitTreeState:"clean", BuildDate:"2016-08-26T18:06:06Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"linux/amd64"}
bash-4.4$ kubectl get componentstatus
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-1 Healthy {"health": "true"}
etcd-2 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}我会非常感谢你的帮助,我在一次黑客马拉松上举起了一些人;)
发布于 2018-11-14 19:36:24
在kubectl和Kubernetes集群版本(1.12.2 vs 1.3.6)上存在很大的不匹配。我建议您下载kubectl 1.3.6。如果您使用的是Linux:
$ wget https://dl.k8s.io/v1.3.6/kubernetes-client-linux-amd64.tar.gz
$ tar zxvf kubernetes-client-linux-amd64.tar.gz或者MacOS:
$ wget https://dl.k8s.io/v1.3.6/kubernetes-client-darwin-amd64.tar.gz
$ tar zxvf kubernetes-client-darwin-amd64.tar.gzhttps://stackoverflow.com/questions/53306747
复制相似问题