运行时出现以下错误
kubectl create -f pod.yaml
误差
Error from server (BadRequest): error when creating "pod.yaml": Pod in
version "applicant:v1" cannot be handled as a Pod: no kind "Pod" is
registered for version "applicant:v1"
minikube已经启动并运行,我甚至尝试将其更改为kind: Deployment
,但我得到了另一个错误,说:
error: unable to recognize "pod.yaml": no matches for /, Kind=Deployment
亚姆勒:
apiVersion: apps/v1
kind: Deployment
metadata:
name: customer-applicant
labels:
app: applicant-vue
spec:
replicas: 1
selector:
matchLabels:
app: applicant-vue
template:
metadata:
labels:
app: applicant-vue
spec:
containers:
- name: api-applicant
image: api-applicant
ports:
- containerPort: 8080
- containerPort: 8000
resources: {}
volumeMounts:
- mountPath: /usr/local/tomcat/logs
name: api-applicant-claim
# import
- name: applicant-import
image: applicant-import
resources: {}
# cache
- name: cache
image: cache
resources:
limits:
memory: "536870912"
# storage
- name: storage
image: storage
ports:
- containerPort: 7000
- containerPort: 7001
- containerPort: 7199
- containerPort: 9042
- containerPort: 9160
resources: {}
# view
- name: view
image: view
ports:
- containerPort: 3000
resources: {}
volumes:
- name: applicant-claim
persistentVolumeClaim:
claimName: applicant-claim
# tomcat
- name: tomcat
image: tomcat
# node
- name: node
image: node
resources: {}
# openJdk
- name: node
- image: node
resources: {}
1条答案
按热度按时间7rfyedvj1#
你有很多问题。我已经描述了其中的一些:
1.
pod.yaml
文件的结构是Deployment
对象的结构。2.
apiVersion
适用于Deployment
,取决于kubernetes版本:apps/v1beta1
(对于1.8.0之前的版本)apps/v1beta2
适用于1.8.0及1.9.0之前的版本apps/v1
(适用于1.9.0以上的版本)因此,如果您在最新的kubernetes集群上部署
pod.yaml
,则应从以下位置启动:**3.**零件:
应改为:
**4.**第二个
spec
块应在与spec.template.metadata
相同的级别上移动:最终的
deployment.yaml
为: