将 Compose 中描述的应用程序部署到 Kubernetes 集群
:warning: This project is no longer maintained :warning:
Compose on Kubernetes allows you to deploy Docker Compose files onto a Kubernetes cluster.
More documentation can be found in the docs/ directory. This includes:
On Docker Desktop you will need to activate Kubernetes in the settings to use Compose on Kubernetes.
kubectl create namespace composeCompose on Kubernetes requires an etcd instance (in addition to the kube-system etcd instance). Please follow How to deploy etcd.
Run installer-[darwin|linux|windows.exe] -namespace=compose -etcd-servers=http://compose-etcd-client:2379.
You can check that Compose on Kubernetes is installed by checking for the availability of the API using the command:
$ kubectl api-versions | grep compose
compose.docker.com/v1beta1
compose.docker.com/v1beta2
To deploy a stack, you can use the Docker CLI:
$ cat docker-compose.yml
version: '3.3'
services:
db:
build: db
image: dockersamples/k8s-wordsmith-db
words:
build: words
image: dockersamples/k8s-wordsmith-api
deploy:
replicas: 5
web:
build: web
image: dockersamples/k8s-wordsmith-web
ports:
- "33000:80"
$ docker stack deploy --orchestrator=kubernetes -c docker-compose.yml hellokube
$ docker stack rm --orchestrator=kubernetes hellokube
See the contributing guides for how to contribute code.
makeDOCKER_BUILDKIT=1 in your environmentTo build and install a debug version of Compose on Kubernetes onto Docker Desktop, you can use the following command:
$ make -f debug.Makefile install-debug-images
This command:
docker namespaceYou can verify that Compose on Kubernetes is running with kubectl as follows:
…
If you describe one of the deployments, you should see *-debug:latest in the
image name.
To build and install a live debugging version of Compose on Kubernetes onto Docker Desktop, you can use the following command:
$ make -f debug.Makefile install-live-debug-images
This command:
docker namespacelocalhost:40000: Compose controllerlocalhost:40001: API serverTo attach a debugger you have multiple options:
.idea of the repositoryDebug all config, setup breakpoints and start the debuggerlocahost:40000 and localhost:40001dlv connect localhost:40000 then type continue and hit enterTo verify that the components are installed, you can use the following command:
$ kubectl get all -n docker
To verify that the API server has started, ensure that it has started logging:
…
To verify that the Compose controller has started, ensure that it is logging:
kubectl logs -f -n docker deployment.apps/compose
API server listening at: [::]:40000
Version: v0.4.16-dirty
Git commit: b2e3a6b-dirty
OS/Arch: linux/amd64
Built: Fri Dec 7 15:18:13 2018
time="2018-12-07T15:25:19Z" level=info msg="Controller ready"
To reinstall the default Compose on Kubernetes on Docker Desktop, simply restart your Kubernetes cluster. You can do this by deactivating and then reactivating Kubernetes or by restarting Docker Desktop. See the contributing and debugging guides.
暂无开放 Issues,或尚未同步最近议题。