【发布时间】:2019-10-12 22:26:24
【问题描述】:
我在 OVH 上运行 kubernetes 没有问题。但是由于其他问题,我最近重新安装了构建服务器并设置了所有内容,但是当尝试应用文件时,它给出了这个可怕的错误。我错过了什么吗?这个错误的真正含义是什么?
+ kubectl apply -f k8s
unable to recognize "k8s/driver-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
unable to recognize "k8s/driver-mysql-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-mysql-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
unable to recognize "k8s/driver-mysql-persistent-volume-claim.yaml": no matches for kind "PersistentVolumeClaim" in version "v1"
unable to recognize "k8s/driver-phpmyadmin-cluster-ip-service.yaml": no matches for kind "Service" in version "v1"
unable to recognize "k8s/driver-phpmyadmin-deployment.yaml": no matches for kind "Deployment" in version "apps/v1"
我在 SO 上尝试了所有以前的答案,但没有一个适合我。我不认为我真的需要它,“如果我错了,请纠正我”。我真的很想得到一些帮助。
我已经安装了 kubectl,并且我得到了一个我使用的配置文件。
当我执行kubectl get pods 命令时,我得到了之前部署的 pod
这些是一些 yml 文件
k8s/driver-cluster-ip-service.yaml
apiVersion: v1
kind: Service
metadata:
name: driver-cluster-ip-service
spec:
type: ClusterIP
selector:
component: driver-service
ports:
- port: 3000
targetPort: 8080
k8s/driver-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: driver-deployment
spec:
replicas: 1
selector:
matchLabels:
component: driver-service
template:
metadata:
labels:
component: driver-service
spec:
containers:
- name: driver
image: repo.taxi.com/driver-service
imagePullPolicy: Always
ports:
- containerPort: 8080
imagePullSecrets:
- name: taxiregistry
dockerfile
FROM maven:3.6.0-jdk-8-slim AS build
COPY . /home/app/
RUN rm /home/app/controllers/src/main/resources/application.properties
RUN mv /home/app/controllers/src/main/resources/application-kubernetes.properties /home/app/controllers/src/main/resources/application.properties
RUN mvn -f /home/app/pom.xml clean package
FROM openjdk:8-jre-slim
COPY --from=build /home/app/controllers/target/controllers-1.0.jar /usr/local/lib/driver-1.0.0.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/driver-1.0.0.jar"]
kubectl api-versions
【问题讨论】:
-
这与您在凭据失败时遇到的错误相同——如果您询问
kubectl get nodes,您将看到相同的错误;您必须理顺构建服务器上的凭据 -
当我输入
kubectl get nodes时,我得到了一个节点.. 看下面的截图imgur.com/52RQynw 我需要在某个地方说它需要使用那个节点吗?如果是这样,我该怎么做?
标签: linux docker kubernetes microservices kubectl