Skip to content

Commit d3613ea

Browse files
authored
Merge pull request #46913 from ktvargo-ms/46595
Revise stale "Translate a Docker Compose File to Kubernetes Resources" page
2 parents 79cf268 + cca76d5 commit d3613ea

File tree

1 file changed

+49
-52
lines changed

1 file changed

+49
-52
lines changed

content/en/docs/tasks/configure-pod-container/translate-compose-kubernetes.md

Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Kompose is released via GitHub on a three-week cycle, you can see all current re
2929

3030
```sh
3131
# Linux
32-
curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.0/kompose-linux-amd64 -o kompose
32+
curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-linux-amd64 -o kompose
3333

3434
# macOS
35-
curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.0/kompose-darwin-amd64 -o kompose
35+
curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-darwin-amd64 -o kompose
3636

3737
# Windows
38-
curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.0/kompose-windows-amd64.exe -o kompose.exe
38+
curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-windows-amd64.exe -o kompose.exe
3939

4040
chmod +x kompose
4141
sudo mv ./kompose /usr/local/bin/kompose
@@ -93,26 +93,27 @@ you need is an existing `docker-compose.yml` file.
9393
1. Go to the directory containing your `docker-compose.yml` file. If you don't have one, test using this one.
9494

9595
```yaml
96-
version: "2"
9796

9897
services:
9998

100-
redis-master:
101-
image: registry.k8s.io/redis:e2e
99+
redis-leader:
100+
container_name: redis-leader
101+
image: redis
102102
ports:
103103
- "6379"
104104

105-
redis-slave:
106-
image: gcr.io/google_samples/gb-redisslave:v3
105+
redis-replica:
106+
container_name: redis-replica
107+
image: redis
107108
ports:
108109
- "6379"
109-
environment:
110-
- GET_HOSTS_FROM=dns
110+
command: redis-server --replicaof redis-leader 6379 --dir /tmp
111111

112-
frontend:
113-
image: gcr.io/google-samples/gb-frontend:v4
112+
web:
113+
container_name: web
114+
image: quay.io/kompose/web
114115
ports:
115-
- "80:80"
116+
- "8080:8080"
116117
environment:
117118
- GET_HOSTS_FROM=dns
118119
labels:
@@ -129,27 +130,27 @@ you need is an existing `docker-compose.yml` file.
129130
The output is similar to:
130131

131132
```none
132-
INFO Kubernetes file "frontend-tcp-service.yaml" created
133-
INFO Kubernetes file "redis-master-service.yaml" created
134-
INFO Kubernetes file "redis-slave-service.yaml" created
135-
INFO Kubernetes file "frontend-deployment.yaml" created
136-
INFO Kubernetes file "redis-master-deployment.yaml" created
137-
INFO Kubernetes file "redis-slave-deployment.yaml" created
133+
INFO Kubernetes file "redis-leader-service.yaml" created
134+
INFO Kubernetes file "redis-replica-service.yaml" created
135+
INFO Kubernetes file "web-tcp-service.yaml" created
136+
INFO Kubernetes file "redis-leader-deployment.yaml" created
137+
INFO Kubernetes file "redis-replica-deployment.yaml" created
138+
INFO Kubernetes file "web-deployment.yaml" created
138139
```
139140

140141
```bash
141-
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
142+
kubectl apply -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml
142143
```
143144

144145
The output is similar to:
145146

146147
```none
147-
service/frontend-tcp created
148-
service/redis-master created
149-
service/redis-slave created
150-
deployment.apps/frontend created
151-
deployment.apps/redis-master created
152-
deployment.apps/redis-slave created
148+
deployment.apps/redis-leader created
149+
deployment.apps/redis-replica created
150+
deployment.apps/web created
151+
service/redis-leader created
152+
service/redis-replica created
153+
service/web-tcp created
153154
```
154155

155156
Your deployments are running in Kubernetes.
@@ -159,39 +160,35 @@ you need is an existing `docker-compose.yml` file.
159160
If you're already using `minikube` for your development process:
160161

161162
```bash
162-
minikube service frontend
163+
minikube service web-tcp
163164
```
164165

165166
Otherwise, let's look up what IP your service is using!
166167

167168
```sh
168-
kubectl describe svc frontend
169+
kubectl describe svc web-tcp
169170
```
170171

171172
```none
172-
Name: frontend-tcp
173-
Namespace: default
174-
Labels: io.kompose.service=frontend-tcp
175-
Annotations: kompose.cmd: kompose convert
176-
kompose.service.type: LoadBalancer
177-
kompose.version: 1.26.0 (40646f47)
178-
Selector: io.kompose.service=frontend
179-
Type: LoadBalancer
180-
IP Family Policy: SingleStack
181-
IP Families: IPv4
182-
IP: 10.43.67.174
183-
IPs: 10.43.67.174
184-
Port: 80 80/TCP
185-
TargetPort: 80/TCP
186-
NodePort: 80 31254/TCP
187-
Endpoints: 10.42.0.25:80
188-
Session Affinity: None
189-
External Traffic Policy: Cluster
190-
Events:
191-
Type Reason Age From Message
192-
---- ------ ---- ---- -------
193-
Normal EnsuringLoadBalancer 62s service-controller Ensuring load balancer
194-
Normal AppliedDaemonSet 62s service-controller Applied LoadBalancer DaemonSet kube-system/svclb-frontend-tcp-9362d276
173+
Name: web-tcp
174+
Namespace: default
175+
Labels: io.kompose.service=web-tcp
176+
Annotations: kompose.cmd: kompose convert
177+
kompose.service.type: LoadBalancer
178+
kompose.version: 1.33.0 (3ce457399)
179+
Selector: io.kompose.service=web
180+
Type: LoadBalancer
181+
IP Family Policy: SingleStack
182+
IP Families: IPv4
183+
IP: 10.102.30.3
184+
IPs: 10.102.30.3
185+
Port: 8080 8080/TCP
186+
TargetPort: 8080/TCP
187+
NodePort: 8080 31624/TCP
188+
Endpoints: 10.244.0.5:8080
189+
Session Affinity: None
190+
External Traffic Policy: Cluster
191+
Events: <none>
195192
```
196193

197194
If you're using a cloud provider, your IP will be listed next to `LoadBalancer Ingress`.
@@ -206,7 +203,7 @@ you need is an existing `docker-compose.yml` file.
206203
resources used.
207204

208205
```sh
209-
kubectl delete -f frontend-tcp-service.yaml,redis-master-service.yaml,redis-slave-service.yaml,frontend-deployment.yaml,redis-master-deployment.yaml,redis-slave-deployment.yaml
206+
kubectl delete -f web-tcp-service.yaml,redis-leader-service.yaml,redis-replica-service.yaml,web-deployment.yaml,redis-leader-deployment.yaml,redis-replica-deployment.yaml
210207
```
211208

212209
<!-- discussion -->

0 commit comments

Comments
 (0)