Converting
Install kompose
> brew install kompose
Start up directly
> kompose up
Export docker-compose
> kompose convert
$ kompose convert WARN Volume mount on the host "/Users/john.mehan/projects/cloud/deployment/is-config/IND" isn't supported - ignoring path on the host INFO Kubernetes file "cloudservice-service.yaml" created INFO Kubernetes file "isservice-service.yaml" created INFO Kubernetes file "postgres-service.yaml" created INFO Kubernetes file "redis-service.yaml" created INFO Kubernetes file "cloudservice-deployment.yaml" created INFO Kubernetes file "isservice-deployment.yaml" created INFO Kubernetes file "isservice-claim0-persistentvolumeclaim.yaml" created INFO Kubernetes file "postgres-deployment.yaml" created INFO Kubernetes file "db-volume-persistentvolumeclaim.yaml" created INFO Kubernetes file "redis-deployment.yaml" created
Create Kubectl
Might have to have minikube up and running for this to work
> minikube start
$ minikube start $ kubectl create -f cloudservice-service.yaml,isservice-service.yaml,postgres-service.yaml,redis-service.yaml,cloudservice-deployment.yaml,isservice-deployment.yaml,isservice-claim0-persistentvolumeclaim.yaml,postgres-deployment.yaml,db-volume-persistentvolumeclaim.yaml,redis-deployment.yaml service/cloudservice created service/isservice created service/postgres created service/redis created deployment.extensions/cloudservice created deployment.extensions/isservice created persistentvolumeclaim/isservice-claim0 created deployment.extensions/postgres created persistentvolumeclaim/db-volume created deployment.extensions/redis created
Expose a service
> kubectl expose deployment cloudservice --type=NodePort --name=cload-service
$ kubectl expose deployment cloudservice --type=NodePort --name=cload-service service/cload-service exposed $ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE cload-service NodePort 10.105.166.253 <none> 8080:32696/TCP 5s cloudservice ClusterIP 10.107.194.8 <none> 80/TCP 37m hello-minikube NodePort 10.106.20.131 <none> 8080:32733/TCP 224d isservice ClusterIP 10.101.181.189 <none> 7080/TCP 37m kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 224d postgres ClusterIP 10.105.249.194 <none> 5432/TCP 37m redis ClusterIP 10.98.155.80 <none> 6379/TCP 37m
Pulling image from Docker Registry
Create a Secret in the cluster that holds your authorization token
> kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
kubectl create secret docker-registry regcred --docker-server=http://localhost:5000/ --docker-username=username --docker-password=password --docker-email=john.mehan@irdeto.com secret/regcred created
References
Reference | URL |
---|---|
Translate docker compose to Kubernetes | https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/ |
Kotacoda Kubernetes Playground | https://www.katacoda.com/courses/kubernetes/playground |
Pull an image from a Private Registry | https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ |