我有这个docker compose文件,可以正常工作。但是我使用“ kompose convert -f docker-compose.yam -o deploy.yaml”来获取用于kubernetes部署的yaml文件。
但是当我去“ kubectl apply -f deploy.yaml”
我收到此错误 “服务/ cms已创建 服务/ mysqldb创建 持久卷声明/我的数据卷已配置 无法识别版本“ extensions / v1beta1”中与“部署”类型匹配的项 无法识别版本“ extensions / v1beta1”中的“部署”类型的任何匹配项
我正在使用minikube。 请帮帮我。
docker-compose文件内容
version: "2"
services:
cms:
image: 1511981217/cms_mysql:0.0.2
ports:
- "8080:8080"
networks:
- cms-network
depends_on:
- mysqldb
mysqldb:
image: mysql:8
ports:
- "3306:3306"
networks:
- cms-network
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=cmsdb
volumes:
- my-datavolume:/var/lib/mysql
networks:
cms-network:
volumes:
my-datavolume:
deploy.yaml文件内容
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o kubemanifests_2.yaml
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: cms
name: cms
spec:
ports:
- name: "8080"
port: 8080
targetPort: 8080
selector:
io.kompose.service: cms
status:
loadBalancer: {}
- apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o kubemanifests_2.yaml
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: mysqldb
name: mysqldb
spec:
ports:
- name: "3306"
port: 3306
targetPort: 3306
selector:
io.kompose.service: mysqldb
status:
loadBalancer: {}
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o kubemanifests_2.yaml
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: cms
name: cms
spec:
replicas: 1
strategy: {}
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o kubemanifests_2.yaml
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: cms
spec:
containers:
- image: 1511981217/cms_mysql:0.0.2
name: cms
ports:
- containerPort: 8080
resources: {}
restartPolicy: Always
status: {}
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o kubemanifests_2.yaml
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: mysqldb
name: mysqldb
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o kubemanifests_2.yaml
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: mysqldb
spec:
containers:
- env:
- name: MYSQL_DATABASE
value: cmsdb
- name: MYSQL_ROOT_PASSWORD
value: root
image: mysql:8
name: mysqldb
ports:
- containerPort: 3306
resources: {}
volumeMounts:
- mountPath: /var/lib/mysql
name: my-datavolume
restartPolicy: Always
volumes:
- name: my-datavolume
persistentVolumeClaim:
claimName: my-datavolume
status: {}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: my-datavolume
name: my-datavolume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
kind: List
metadata: {}
```
答案 0 :(得分:0)
extensions/v1beta1
在kubernetes版本1.16
中已弃用。在yaml中将extensions/v1beta1
更改为apps/v1
,它应与版本高于{{ 1}}