Stale page "Translate a Docker Compose File to Kubernetes Resources"
atnjqt opened this issue · comments
Problem
This demonstration for converting docker compose to a kubernetes demo is referencing some old docker image / manifest types that are no longer supported and I think they fail to build, this breaks the demo workflow.
Steps to Reproduce
Following the guide as described isn't working... To test, running a docker compose up --build
confirms this sample yaml file is using an obsolete version
tag, and more so the container images aren't compliant.
$ docker compose up --build
[+] Running 2/3
⠹ redis-master Pulling 0.3s
✘ redis-slave Error context canceled 0.3s
✘ frontend Error context canceled 0.3s
[DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of registry.k8s.io/redis:e2e to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/
Running the kompose conversion & apply works, but the application never shows up when attempting to curl (using minikube tunnel
for the LoadBalancer
, or even just changing to NodePort
for local dev).
$ kompose convert
$ kubectl apply -f frontend-tcp-service.yaml,redis-master-service.yaml,redis-slave-service.yaml,frontend-deployment.yaml,redis-master-deployment.yaml,redis-slave-deployment.yaml
- trying to get the minikube service (with minikube tunnel running), it fails with the following:
$minikube service frontend-tcp
|-----------|--------------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|--------------|-------------|---------------------------|
| default | frontend-tcp | 80/80 | http://192.168.49.2:31656 |
|-----------|--------------|-------------|---------------------------|
❌ Exiting due to SVC_UNREACHABLE: service not available: no running pod for service frontend-tcp found
Checking the pod confirms the image pull fails with an ImagePullBackOff
:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
frontend-967776856-dbntg 0/1 ImagePullBackOff 0 3m50s
redis-master-6d74dffd5d-ngj7s 0/1 ImagePullBackOff 0 3m50s
redis-slave-64b5589df9-nzrb4 1/1 Running 0 3m50s
- Same when trying to curl
$ curl "http://$(minikube ip):$(kubectl get svc frontend-tcp -o=jsonpath='{.spec.ports[0].nodePort}')"
curl: (7) Failed to connect to 192.168.49.2 port 31656: Connection refused```
## Resolution
I believe the maintainers need to kindly update the Docker Compose yaml sample file provided to reflect newer docker images! Thanks in advance for this helpful demonstration 💯
This refers specifically to the information contained here: https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/ which was last updated funny enough on my birthday, February 5th, 2023. Probably just needs to be updated given newer Dockerfile support versions / manifests
It was also I think necessary to add the Ingress add-on for minikube https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Fx86-64%2Fstable%2Fdebian+package#LoadBalancer
/language en
maybe the updated version of this demo is here: https://github.com/kubernetes/kompose as it looks like that docker compose.yaml sample does in fact build with docker. Running kompose convert though doesn't work on that. Probably just some divergence
/kind bug
/retitle Stale page "Translate a Docker Compose File to Kubernetes Resources"
/triage accepted
/assign
Issues with image pull:
Warning Failed 17m (x4 over 19m) kubelet Failed to pull image "gcr.io/google-samples/gb-frontend:v4": Error response from daemon: manifest for gcr.io/google-samples/gb-frontend:v4 not found: manifest unknown: Failed to fetch "v4" from request "/v2/google-samples/gb-frontend/manifests/v4"
Changes to commands/files:
#Upgrade to v1.33
curl -L https://github.com/kubernetes/kompose/releases/download/v1.33.0/kompose-linux-amd64 -o kompose
#Update to docker-compose.yml based on kompose site examples
At kompose/examples/compose.yaml at main · kubernetes/kompose (github.com)
services:
redis-leader:
container_name: redis-leader
image: redis
ports:
- "6379"
redis-replica:
container_name: redis-replica
image: redis
ports:
- "6379"
command: redis-server --replicaof redis-leader 6379 --dir /tmp
web:
container_name: web
image: quay.io/kompose/web
ports:
- "8080:8080"
environment:
- GET_HOSTS_FROM=dns
labels:
kompose.service.type: LoadBalancer
#Apply new yaml files
kubectl apply -f redis-leader-deployment.yaml, redis-replica-deployment.yaml, web-deployment.yaml, redis-leader-service.yaml,redis-replica-service.yaml,web-tcp-service.yaml
Changes to Output:
INFO Kubernetes file "redis-leader-service.yaml" created
INFO Kubernetes file "redis-replica-service.yaml" created
INFO Kubernetes file "web-tcp-service.yaml" created
INFO Kubernetes file "redis-leader-deployment.yaml" created
INFO Kubernetes file "redis-replica-deployment.yaml" created
INFO Kubernetes file "web-deployment.yaml" created
deployment.apps/redis-leader created
deployment.apps/redis-replica created
deployment.apps/web created
service/redis-leader created
service/redis-replica created
service/web-tcp created
Changes to Testing Services:
minikube service web-tcp
|-----------|---------|-------------|---------------------------|
NAMESPACE | NAME | TARGET PORT | URL |
---|---|---|---|
default | web-tcp | 8080/8080 | http://192.168.49.2:31624/ |
----------- | --------- | ------------- | --------------------------- |
🏃 Starting tunnel for service web-tcp. | |||
----------- | --------- | ------------- | ------------------------ |
NAMESPACE | NAME | TARGET PORT | URL |
----------- | --------- | ------------- | ------------------------ |
default | web-tcp | http://127.0.0.1:45953/ | |
----------- | --------- | ------------- | ------------------------ |
🎉 Opening service default/web-tcp in default browser... | |||
❗ Because you are using a Docker driver on linux, the terminal needs to be open to run it. |
kubectl describe service web-tcp
Name: web-tcp
Namespace: default
Labels: io.kompose.service=web-tcp
Annotations: kompose.cmd: kompose convert
kompose.service.type: LoadBalancer
kompose.version: 1.33.0 (3ce457399)
Selector: io.kompose.service=web
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.102.30.3
IPs: 10.102.30.3
Port: 8080 8080/TCP
TargetPort: 8080/TCP
NodePort: 8080 31624/TCP
Endpoints: 10.244.0.5:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: