Converting Docker-Compose to Kubernetes-Kompose file
Introduction
kompose is a convenience tool to go from local Docker development to managing your application with Kubernetes.
1. Installing Kubernetes-Kompose
curl -L https://github.com/kubernetes/kompose/releases/download/v1.1.0/kompose-linux-amd64 -o kompose
chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
2. Get a sample docker-compose.yaml file
wget https://raw.githubusercontent.com/kubernetes/kompose/master/examples/docker-compose-v3.yaml
mv docker-compose-v3.yaml docker-compose.yaml
3. Move into the directory having the docker-compose.yml file
kompose up
hadoop@k8s-00:~$ kompose up
We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
INFO Successfully created Service: redis
INFO Successfully created Service: web
INFO Successfully created Deployment: redis
INFO Successfully created Deployment: web
4. Get the running pods as follows
kubectl get pods
hadoop@k8s-00:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
frontend-68c74b6cff-g9f5h 1/1 Running 0 3m
redis-master-74b5b4995f-6nrgf 1/1 Running 0 3m
redis-slave-75f5b85bd7-6k9z7 1/1 Running 0 3m