Deployment create or apply -f 파일이름 실행시 아래와 같이 에러 메세지 출력 (참고 apiVersion: apps/v1)



[root@hadoopm KUBE]# kubectl apply -f deployment-definition.yml

Error from server (BadRequest): error when creating "deployment-definition.yml": Deployment in version "v1" cannot be handled as a Deployment: no kind "Deployment" is registered for version "apps/v1"



이럴때 우선 k8s 버젼확인

root@hadoopm KUBE]# kubectl  version

Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d


뭐 이렇게 하는게 맞는진 모르지만


암튼..


K8S가 1.9 밑에 버젼 1.8 이나 1.7 버젼이면 apiVersion: apps/v1beta1   <=요렇게 변경해준다 1.9이상이면 에러가 안나겠죵(apps/v1)


그럼 된다..


-----------------deployment-definition.yml ------------------------------

apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
labels:
app: myapp
type: front-end
spec:
template:
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: dockertest2.io:12000/nginx:latest
replicas: 3
selector:
matchLabels:
type: front-end

[root@hadoopm KUBE]# kubectl get deployments

NAME               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE

myapp-deployment   3         3         3            3           6m

nginx              1         1         1            1           5d


[root@hadoopm KUBE]# kubectl get replicaset

NAME                          DESIRED   CURRENT   READY     AGE

myapp-deployment-3571195553   3         3         3         6m

nginx-2496978322              1         1         1         5d


[root@hadoopm KUBE]# kubectl get pods

NAME                                READY     STATUS    RESTARTS   AGE

myapp-deployment-3571195553-27hgj   1/1       Running   0          7m

myapp-deployment-3571195553-7hzvr   1/1       Running   0          7m

myapp-deployment-3571195553-gw4xn   1/1       Running   0          7m



+ Recent posts