Я пытаюсь очень простой учебник, объясняющий, как конвертировать docker -композицию в минишифт ( Minishift и Kompose . Я пытался конвертировать и pu sh пример docker -compose.yml
version: "2"
services:
redis-master:
image: k8s.gcr.io/redis:e2e
ports:
- "6379"
redis-slave:
image: gcr.io/google_samples/gb-redisslave:v1
ports:
- "6379"
environment:
- GET_HOSTS_FROM=dns
frontend:
image: gcr.io/google-samples/gb-frontend:v4
ports:
- "80:80"
environment:
- GET_HOSTS_FROM=dns
labels:
kompose.service.type: LoadBalancer
Я успешно сочиняю и pu sh, как я вижу из этих журналов:
C:\Users\Cast\docker-compose-to-minishift>kompose-windows-amd64 up --provider=openshift
[36mINFO[0m We are going to create OpenShift DeploymentConfigs, Services and PersistentVolumeClaims for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead.
[36mINFO[0m Deploying application in "myproject" namespace
[36mINFO[0m Successfully created Service: frontend
[36mINFO[0m Successfully created Service: redis-master
[36mINFO[0m Successfully created Service: redis-slave
[36mINFO[0m Successfully created DeploymentConfig: frontend
[36mINFO[0m Successfully created ImageStream: frontend
[36mINFO[0m Successfully created DeploymentConfig: redis-master
[36mINFO[0m Successfully created ImageStream: redis-master
[36mINFO[0m Successfully created DeploymentConfig: redis-slave
[36mINFO[0m Successfully created ImageStream: redis-slave
Your application has been deployed to OpenShift. You can run 'oc get dc,svc,is,pvc' for details.
C:\Users\Cast\docker-compose-to-minishift>oc get dc
NAME REVISION DESIRED CURRENT TRIGGERED BY
frontend 0 1 0 config,image(frontend:v4)
redis-master 1 1 1 config,image(redis-master:e2e)
redis-slave 1 1 1 config,image(redis-slave:v1)
Тем не менее, я не смог добраться до веб-приложения и просмотреть найденные журналы «Внешний интерфейс контейнера часто падает. Он должен подождать, пока он не будет перезапущен снова», и щелкнул по деталям:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.13. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Обыскивая, я обнаружил, что кто-то предложил изменить порт 80 на какой-то не root привилегированный порт (например, 8080). Поэтому я изменил его в своем docker -компоненте, вручную удалил пространство имен myproject, заново создал его в OpenShift Web Console и попытался запустить еще раз. Точно такое же исключение с тем же сообщением.
В случае, если это уместно, у меня есть другое окно cmd с
C:\Users\Cast\docker-compose-to-minishift>kubectl proxy --port=8080
Starting to serve on 127.0.0.1:8080
Я довольно новичок при переходе от docker -составить к мини-смещению (впервые используя Kompos инструмент, если честно).
Мой главный вопрос: почему у меня все та же проблема, если я уже изменил порты с 80:80 на 8080: 8080 в docker -compose
frontend:
image: gcr.io/google-samples/gb-frontend:v4
ports:
- "8080:8080"
Вторичный вопрос: что я должен проверить, чтобы понять, почему я не могу запустить службу pront-end? Это довольно ограниченное исключение при условии.
*** отредактировано
преобразовано docker - составить с помощью kompose (только файлы переднего плана)
frontend-imagestream
apiVersion: v1
kind: ImageStream
metadata:
creationTimestamp: null
labels:
io.kompose.service: frontend
name: frontend
spec:
tags:
- annotations: null
from:
kind: DockerImage
name: gcr.io/google-samples/gb-frontend:v4
generation: null
importPolicy: {}
name: v4
status:
dockerImageRepository: ""
frontend -service
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: C:\tools\kompose-windows-amd64.exe convert --provider=openshift
kompose.service.type: LoadBalancer
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: frontend
name: frontend
spec:
ports:
- name: "8080"
port: 8080
targetPort: 8080
selector:
io.kompose.service: frontend
type: LoadBalancer
status:
loadBalancer: {}
frontend-deployconfig
apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
kompose.cmd: C:\tools\kompose-windows-amd64.exe convert --provider=openshift
kompose.service.type: LoadBalancer
kompose.version: 1.19.0 (f63a961c)
creationTimestamp: null
labels:
io.kompose.service: frontend
name: frontend
spec:
replicas: 1
selector:
io.kompose.service: frontend
strategy:
resources: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: frontend
spec:
containers:
- env:
- name: GET_HOSTS_FROM
value: dns
image: ' '
name: frontend
ports:
- containerPort: 8080
resources: {}
restartPolicy: Always
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- frontend
from:
kind: ImageStreamTag
name: frontend:v4
type: ImageChange
status: {}
Добавлены все журналы (я удалил Redis и оставил только службу FrontEnd, так как она была единственной причиной проблемы):
Windows PowerShell
Copyright (C) Microsoft Corporation. Todos os direitos reservados.
Experimente a nova plataforma cruzada PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> cd C:\to_learn\docker-compose-to-minishift\first-try
PS C:\to_learn\docker-compose-to-minishift\first-try> kompose-windows-amd64 up --provider=openshift
[36mINFO[0m We are going to create OpenShift DeploymentConfigs, Services and PersistentVolumeClaims for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead.
[36mINFO[0m Deploying application in "myproject" namespace
[36mINFO[0m Successfully created Service: frontend
[36mINFO[0m Successfully created DeploymentConfig: frontend
[36mINFO[0m Successfully created ImageStream: frontend
Your application has been deployed to OpenShift. You can run 'oc get dc,svc,is,pvc' for details.
PS C:\to_learn\docker-compose-to-minishift\first-try> oc expose service/frontend
route.route.openshift.io/frontend exposed
PS C:\to_learn\docker-compose-to-minishift\first-try> minishift openshift service frontend --namespace=myproject
|-----------|----------|----------------------|-------------------------------------------------|--------|
| NAMESPACE | NAME | NODEPORT | ROUTE-URL | WEIGHT |
|-----------|----------|----------------------|-------------------------------------------------|--------|
| myproject | frontend | 192.168.99.101:30215 | http://frontend-myproject.192.168.99.101.nip.io | |
|-----------|----------|----------------------|-------------------------------------------------|--------|
PS C:\to_learn\docker-compose-to-minishift\first-try>
И когда я пытаюсь открыть http://frontend-myproject.192.168.99.101.nip.io в Chrome:
Application is not available
The application is currently not serving requests at this endpoint. It may not have been started or is still starting.
...
Отредактировано (при попытке развертывания другого примера приложения)
PS C:\to_learn\docker-compose-to-minishift\first-try> nslookup x.127.0.0.1.xip.io
Servidor: one.one.one.one
Address: 1.1.1.1
Não é resposta autoritativa:
Nome: x.127.0.0.1.xip.io
Address: 127.0.0.1
PS C:\to_learn\docker-compose-to-minishift\first-try> oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth SSPI Kerberos SPNEGO
Server https://192.168.99.101:8443
kubernetes v1.11.0+d4cacc0
PS C:\to_learn\docker-compose-to-minishift\first-try> oc new-app --name='cotd' --labels name='cotd' php~https://github.com/devopswith-openshift/cotd.git -e SELECTOR=cats
--> Found image dc5aa55 (2 months old) in image stream "openshift/php" under tag "7.1" for "php"
Apache 2.4 with PHP 7.1
-----------------------
PHP 7.1 available as container is a base platform for building and running various PHP 7.1 applications and frameworks. PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated web pages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts.
Tags: builder, php, php71, rh-php71
* A source build using source code from https://github.com/devopswith-openshift/cotd.git will be created
* The resulting image will be pushed to image stream tag "cotd:latest"
* Use 'start-build' to trigger a new build
* This image will be deployed in deployment config "cotd"
* Ports 8080/tcp, 8443/tcp will be load balanced by service "cotd"
* Other containers can access this service through the hostname "cotd"
--> Creating resources with label name=cotd ...
imagestream.image.openshift.io "cotd" created
buildconfig.build.openshift.io "cotd" created
deploymentconfig.apps.openshift.io "cotd" created
service "cotd" created
--> Success
Build scheduled, use 'oc logs -f bc/cotd' to track its progress.
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
'oc expose svc/cotd'
Run 'oc status' to view your app.
PS C:\to_learn\docker-compose-to-minishift\first-try> oc expose svc/cotd
route.route.openshift.io/cotd exposed
PS C:\to_learn\docker-compose-to-minishift\first-try> oc status
In project myproject on server https://192.168.99.101:8443
http://cotd-myproject.192.168.99.101.nip.io to pod port 8080-tcp (svc/cotd)
dc/cotd deploys istag/cotd:latest <-
bc/cotd source builds https://github.com/devopswith-openshift/cotd.git on openshift/php:7.1
build #1 pending for 11 minutes
deployment #1 waiting on image or update
http://frontend-myproject.192.168.99.101.nip.io to pod port 8080 (svc/frontend)
dc/frontend deploys istag/frontend:v4
deployment #1 waiting on image or update
4 infos identified, use 'oc status --suggest' to see details.
PS C:\to_learn\docker-compose-to-minishift\first-try> oc status --suggest
In project myproject on server https://192.168.99.101:8443
http://cotd-myproject.192.168.99.101.nip.io to pod port 8080-tcp (svc/cotd)
dc/cotd deploys istag/cotd:latest <-
bc/cotd source builds https://github.com/devopswith-openshift/cotd.git on openshift/php:7.1
build #1 pending for 12 minutes
deployment #1 waiting on image or update
http://frontend-myproject.192.168.99.101.nip.io to pod port 8080 (svc/frontend)
dc/frontend deploys istag/frontend:v4
deployment #1 waiting on image or update
Info:
* dc/cotd has no readiness probe to verify pods are ready to accept traffic or ensure deployment is successful.
try: oc set probe dc/cotd --readiness ...
* dc/cotd has no liveness probe to verify pods are still running.
try: oc set probe dc/cotd --liveness ...
* dc/frontend has no readiness probe to verify pods are ready to accept traffic or ensure deployment is successful.
try: oc set probe dc/frontend --readiness ...
* dc/frontend has no liveness probe to verify pods are still running.
try: oc set probe dc/frontend --liveness ...
View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.
PS C:\to_learn\docker-compose-to-minishift\first-try>
Build Статус ожидания