github.com/docker/compose-on-kubernetes@v0.5.0/README.md (about) 1 > :warning: **This project is no longer maintained** :warning: 2 3 # Compose on Kubernetes 4 5 [](https://circleci.com/gh/docker/compose-on-kubernetes/tree/master) 6 7 Compose on Kubernetes allows you to deploy Docker Compose files onto a 8 Kubernetes cluster. 9 10 # Table of contents 11 12 - [Get started](#get-started) 13 - [Developing Compose on Kubernetes](#developing-compose-on-kubernetes) 14 15 More documentation can be found in the [docs/](./docs) directory. This includes: 16 - [Architecture](./docs/architecture.md) 17 - [Mapping of stack to Kubernetes objects](./docs/mapping.md) 18 - [Compatibility matrix](./docs/compatibility.md) 19 20 # Get started 21 22 ## Install Compose on Kubernetes on Docker Desktop 23 24 ### Pre-requisites 25 26 - [Docker Desktop](https://www.docker.com/products/docker-desktop). 27 - To install etcd using these instructions, you must have [Helm](https://helm.sh) in your client environment. 28 - [Download the Compose on Kubernetes installer](https://github.com/docker/compose-on-kubernetes/releases). 29 30 On Docker Desktop you will need to activate Kubernetes in the settings to use 31 Compose on Kubernetes. 32 33 ### Create compose namespace 34 35 - Create a compose namespace by running `kubectl create namespace compose` 36 37 ### Deploy etcd 38 39 Compose on Kubernetes requires an etcd instance (in addition to the kube-system etcd instance). Please follow [How to deploy etcd](./docs/deploy-etcd.md). 40 41 ### Deploy Compose on Kubernetes 42 43 Run `installer-[darwin|linux|windows.exe] -namespace=compose -etcd-servers=http://compose-etcd-client:2379`. 44 45 ## Check that Compose on Kubernetes is installed 46 47 You can check that Compose on Kubernetes is installed by checking for the 48 availability of the API using the command: 49 50 ```console 51 $ kubectl api-versions | grep compose 52 compose.docker.com/v1beta1 53 compose.docker.com/v1beta2 54 ``` 55 56 ## Deploy a stack 57 58 To deploy a stack, you can use the Docker CLI: 59 60 ```console 61 $ cat docker-compose.yml 62 version: '3.3' 63 64 services: 65 66 db: 67 build: db 68 image: dockersamples/k8s-wordsmith-db 69 70 words: 71 build: words 72 image: dockersamples/k8s-wordsmith-api 73 deploy: 74 replicas: 5 75 76 web: 77 build: web 78 image: dockersamples/k8s-wordsmith-web 79 ports: 80 - "33000:80" 81 82 $ docker stack deploy --orchestrator=kubernetes -c docker-compose.yml hellokube 83 ``` 84 85 ## Remove a stack 86 87 ``` 88 $ docker stack rm --orchestrator=kubernetes hellokube 89 ``` 90 91 # Developing Compose on Kubernetes 92 93 See the [contributing](./CONTRIBUTING.md) guides for how to contribute code. 94 95 ## Pre-requisites 96 97 - `make` 98 - [Docker Desktop](https://www.docker.com/products/docker-desktop) (Mac or Windows) with engine version 18.09 or later 99 - Enable Buildkit by setting `DOCKER_BUILDKIT=1` in your environment 100 - Enable Kubernetes in Docker Desktop settings 101 102 ### For live debugging 103 104 - Debugger capable of remote debugging with Delve API version 2 105 - Goland run-configs are pre-configured 106 107 ## Debug quick start 108 109 ### Debug install 110 111 To build and install a debug version of Compose on Kubernetes onto Docker 112 Desktop, you can use the following command: 113 114 ```console 115 $ make -f debug.Makefile install-debug-images 116 ``` 117 118 This command: 119 - Builds the images with debug symbols 120 - Runs the debug installer: 121 - Installs debug versions of API server and Compose controller in the `docker` namespace 122 - Creates two debugging _LoadBalancer_ services (unused in this mode) 123 124 You can verify that Compose on Kubernetes is running with `kubectl` as follows: 125 126 ```console 127 $ kubectl get all -n docker 128 NAME READY STATUS RESTARTS AGE 129 pod/compose-7c4dfcff76-jgwst 1/1 Running 0 59s 130 pod/compose-api-759f8dbb4b-2z5n2 2/2 Running 0 59s 131 132 NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE 133 service/compose-api ClusterIP 10.98.42.151 <none> 443/TCP 59s 134 service/compose-api-server-remote-debug LoadBalancer 10.101.198.179 localhost 40001:31693/TCP 59s 135 service/compose-controller-remote-debug LoadBalancer 10.101.158.160 localhost 40000:31167/TCP 59s 136 137 NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE 138 deployment.apps/compose 1 1 1 1 59s 139 deployment.apps/compose-api 1 1 1 1 59s 140 141 NAME DESIRED CURRENT READY AGE 142 replicaset.apps/compose-7c4dfcff76 1 1 1 59s 143 replicaset.apps/compose-api-759f8dbb4b 1 1 1 59s 144 ``` 145 146 If you describe one of the deployments, you should see `*-debug:latest` in the 147 image name. 148 149 ### Live debugging install 150 151 To build and install a live debugging version of Compose on Kubernetes onto 152 Docker Desktop, you can use the following command: 153 154 ```console 155 $ make -f debug.Makefile install-live-debug-images 156 ``` 157 158 This command: 159 - Builds the images with debug symbols 160 - Sets the image entrypoint to run a [Delve server](https://github.com/derekparker/delve) 161 - Runs the debug installer 162 - Installs debug version of API server and Compose controller in the `docker` namespace 163 - Creates two debugging _LoadBalancer_ services 164 - `localhost:40000`: Compose controller 165 - `localhost:40001`: API server 166 - The API server and Compose controller only start once a debugger is attached 167 168 To attach a debugger you have multiple options: 169 - Use [GoLand](https://www.jetbrains.com/go/): configuration can be found in `.idea` of the repository 170 - Select the `Debug all` config, setup breakpoints and start the debugger 171 - Set your Delve compatible debugger to point to use `locahost:40000` and `localhost:40001` 172 - Using a terminal: `dlv connect localhost:40000` then type `continue` and hit enter 173 174 To verify that the components are installed, you can use the following command: 175 176 ```console 177 $ kubectl get all -n docker 178 ``` 179 180 To verify that the API server has started, ensure that it has started logging: 181 ```console 182 $ kubectl logs -f -n docker deployment.apps/compose-api compose 183 API server listening at: [::]:40000 184 ERROR: logging before flag.Parse: I1207 15:25:13.760739 11 plugins.go:158] Loaded 2 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,MutatingAdmissionWebhook. 185 ERROR: logging before flag.Parse: I1207 15:25:13.763211 11 plugins.go:161] Loaded 1 validating admission controller(s) successfully in the following order: ValidatingAdmissionWebhook. 186 ERROR: logging before flag.Parse: W1207 15:25:13.767429 11 client_config.go:552] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work. 187 ERROR: logging before flag.Parse: W1207 15:25:13.851500 11 genericapiserver.go:319] Skipping API compose.docker.com/storage because it has no resources. 188 ERROR: logging before flag.Parse: I1207 15:25:13.998154 11 serve.go:116] Serving securely on [::]:9443 189 ``` 190 191 To verify that the Compose controller has started, ensure that it is logging: 192 ```console 193 kubectl logs -f -n docker deployment.apps/compose 194 API server listening at: [::]:40000 195 Version: v0.4.16-dirty 196 Git commit: b2e3a6b-dirty 197 OS/Arch: linux/amd64 198 Built: Fri Dec 7 15:18:13 2018 199 time="2018-12-07T15:25:19Z" level=info msg="Controller ready" 200 ``` 201 202 ## Reinstall default 203 204 To reinstall the default Compose on Kubernetes on Docker Desktop, simply restart 205 your Kubernetes cluster. You can do this by deactivating and then reactivating 206 Kubernetes or by restarting Docker Desktop. 207 See the [contributing](./CONTRIBUTING.md) and [debugging](./DEBUGGING.md) guides. 208 209 # Deploying Compose on Kubernetes 210 211 - Guide for [Azure AKS](./docs/install-on-aks.md). 212 - Guide for [GKE](./docs/install-on-gke.md). 213 - Guide for [Microk8s](./docs/install-on-microk8s.md). 214 - Guide for [Minikube](./docs/install-on-minikube.md).