我的kubernetes在OVH上运行没有问题。但是我最近因为其他问题而重新安装了构建服务器并设置了所有内容,但是当尝试应用文件时,它给出了一个可怕的错误..我错过了什么吗?这个错误的真正含义是什么?
+ 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
命令时,我得到的是在
这些是一些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
答案 0 :(得分:1)
我不得不将二进制文件放在.kube文件夹中,该文件夹应该放在根目录中 就我而言,我必须先在根目录中手动创建.kube文件夹。
此后,我将我的env变量设置为该文件夹,并将配置文件也放置在其中
然后我必须与jenkins用户共享该文件夹,并将权限应用于jenkins组
Jenkins不是最新的,因此我不得不重新启动jenkins服务器。
它就像一种魅力!
请记住重新启动jenkins服务器,以便您所做的更改将对jenkins产生影响。