開發環境下,使用Git推送部署Kubernetes服務。git
Gitkube is a tool for building and deploying docker images on Kubernetes using git push
.github
After a simple initial setup, users can simply keep git push
-ing their repos to build and deploy to Kubernetes automatically.docker
Gitkube will run on any Kubernetes vendor/distribution AS IS. In case you find any difficulties in the setup, please comment on #33api
$ kubectl create -f https://raw.githubusercontent.com/hasura/gitkube/master/manifests/gitkube-setup.yaml $ #expose gitkubed service $ kubectl --namespace kube-system expose deployment gitkubed --type=LoadBalancer --name=gitkubed
Follow this example repo for a typical workflow of gitkube.app
Gitkube has three components:ssh
git push
git push <remote> master
User should have a git repo with source code and a Dockerfile. User should also create a base K8s deployment for the application.ide
A Remote resource consists of 3 parts:post
git push
.Here is a typical spec for a Remote:ui
apiVersion: gitkube.sh/v1alpha1 kind: Remote metadata: name: sampleremote namespace: default spec: # Insert ssh-keys for allowing users to git push authorizedKeys: - "ssh-rsa your-ssh-public-key" # Provide registry details for pushing and pulling image from/into the cluster registry: url: "registry.io/user" credentials: # dockercfg secret secretKeyRef: name: regsecret key: .dockercfg # Define deployment rules deployments: - name: www # Name of K8s deployment which is updated on git push containers: - name: www # Name of container in the deployment which is built during git push path: example/www # Location of source code in the git repo dockerfile: example/www/Dockerfile # Location of Dockerfile for the source code
Once a Remote is created, it gets a git remote url which you can find in its status
specthis
$ kubectl get remote sampleremote -o yaml ... status: remoteUrl: ssh://default-sampleremote@35.225.226.96/~/git/default-sampleremote remoteUrlDesc: ""
Add the generated remoteUrl
in git
$ git add remote sampleremote ssh://default-sampleremote@35.225.226.96/~/git/default-sampleremote
And finally, git push
$ git push sampleremote master
Gitkube is open to evolution. Some of the features to be added in future include:
git push
. Current support is limited to deployments. #19Gitkube is an open source project licensed under Apache License 2.0
Contributions are welcome.
This project has come out of the work at hasura.io. Current maintainers @Tirumarai, @shahidh_k.
Follow @gitkube to stay updated.