gpt4 book ai didi

linux - kubectl 应用-f k8s : is unable to recognize service and deployment and has no matches for kind "Service" in version "v1"

转载 作者:太空宇宙 更新时间:2023-11-04 04:42:51 27 4
gpt4 key购买 nike

我在 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"

我尝试了所有以前的答案,但没有一个对我有用。我不认为我真的需要它,“如果我错了,请纠正我”。我真的很想获得一些帮助。

我已经安装了 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 get pods 命令 get pods

kubectl api 版本

api-versions

最佳答案

找到解决方案

我必须将二进制文件放在 .kube 文件夹中,该文件夹应该放在根目录中就我而言,我必须首先在根目录中手动创建 .kube 文件夹。

之后,我将环境变量设置为该文件夹,并将我的配置文件和我的设置也放在其中

然后我必须与 jenkins 用户共享该文件夹并向 jenkins 组应用权限

Jenkins 不是最新的,所以我不得不重新启动 jenkins 服务器。

它的作用就像一个魅力!

请记住重新启动 jenkins 服务器,以便您所做的更改将在 jenkins 上生效。

关于linux - kubectl 应用-f k8s : is unable to recognize service and deployment and has no matches for kind "Service" in version "v1",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56324466/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com