Пытаюсь перейти с docker -compose на kubernetes. У меня были проблемы с громкостью, поэтому я сделал следующее:
kompose convert --volumes hostPath
Затем у меня возникла другая проблема
no matches for kind "Deployment" in version "extensions/v1beta1"
Итак, я изменил ApiVersion с extension / v1beta1 на app / v1 и добавил "селектор". Теперь я не могу справиться с этой проблемой:
Error from server (Invalid): error when creating "database-deployment.yaml": Deployment.apps "database" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"io.kompose.service":"database"}: `selector` does not match template `labels`
Error from server (Invalid): error when creating "phpmyadmin-deployment.yaml": Deployment.apps "phpmyadmin" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"io.kompose.service":"phpmyadmin"}: `selector` does not match template `labels`
Error from server (Invalid): error when creating "webserver-deployment.yaml": Deployment.apps "webserver" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"io.kompose.service":"webserver"}: `selector` does not match template `labels`
database-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert --volumes hostPath
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: database
app: database
name: database
spec:
selector:
matchLabels:
app: database
template:
metadata:
labels:
io.kompose.service: database
replicas: 1
strategy: {}
template:
metadata:
annotations:
kompose.cmd: kompose convert --volumes hostPath
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: database
spec:
containers:
- env:
- name: MYSQL_DATABASE
value: Bazadanerro
- name: MYSQL_PASSWORD
value: P@$$w0rd
- name: MYSQL_ROOT_PASSWORD
value: P@$$w0rd
- name: MYSQL_USER
value: dockerro
image: mariadb
name: mysql
resources: {}
restartPolicy: Always
status: {}
phpmyadmin-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert --volumes hostPath
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: phpmyadmin
app: phpmyadmin
name: phpmyadmin
spec:
selector:
matchLabels:
app: phpmyadmin
template:
metadata:
labels:
io.kompose.service: database
replicas: 1
strategy: {}
template:
metadata:
annotations:
kompose.cmd: kompose convert --volumes hostPath
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: phpmyadmin
spec:
containers:
- env:
- name: MYSQL_PASSWORD
value: P@$$w0rd
- name: MYSQL_ROOT_PASSWORD
value: P@$$w0rd
- name: MYSQL_USER
value: dockerro
- name: PMA_HOST
value: database
- name: PMA_PORT
value: "3306"
image: phpmyadmin/phpmyadmin
name: phpmyadmins
ports:
- containerPort: 80
resources: {}
restartPolicy: Always
status: {}
И веб-сервер- deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert --volumes hostPath
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: webserver
app: webserverro
name: webserver
spec:
selector:
matchLabels:
app: webserverro
template:
metadata:
labels:
io.kompose.service: webserver
replicas: 1
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert --volumes hostPath
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: webserver
spec:
containers:
- image: webserver
name: webserverro
ports:
- containerPort: 80
resources: {}
volumeMounts:
- mountPath: /var/www/html
name: webserver-hostpath0
restartPolicy: Always
volumes:
- hostPath:
path: /root/webserverro/root/webserverro
name: webserver-hostpath0
status: {}
Что я делаю не так?