Spin-up a platform with a git push!
Setup
- Create a new repository from this template
- it works both with Public and Private repositories
- naming convention:
kube-<CLUSTER_NAME>
or<CLUSTER_NAME>-k8s
- Replace repository URL
OLD_REPOSITORY=git@github.com:hckops/kube-template.git NEW_REPOSITORY=<HTTPS_OR_SSH_GIT_URL> grep -Rl --exclude=*.md --exclude-dir=.git ${OLD_REPOSITORY} . | xargs \ sed -i "s|${OLD_REPOSITORY}|${NEW_REPOSITORY}|g"
- Rename cluster name and definition
clusters/kube-<CLUSTER_NAME>.yaml
grep -Rl --exclude-dir=.git "do-template" . | xargs \ sed -i "s|do-template|<CLUSTER_NAME>|g"
- Override the credential template with the right owner
# argocd-config/values-bootstrap.yaml + argocd.configs.credentialTemplates.ssh-creds.url: git@github.com:<OWNER_OR_REPOSITORY> - argocd.configs.credentialTemplates.ssh-creds.url: git@github.com:hckops
- Add the following action secrets
DIGITALOCEAN_ACCESS_TOKEN
required to privision a cluster with DigitalOcean
ARGOCD_ADMIN_PASSWORD
andARGOCD_GIT_SSH_KEY
required to bootstrap this platform with ArgoCDDISCORD_WEBHOOK_URL
optional, to notify the status in a Discord channel- for more info see workflow and hckops/actions
- Update the cluster definition and push all the changes
or simply create the cluster by running
# clusters/kube-<CLUSTER_NAME>.yaml + status: UP - status: DOWN
make cluster-up
- Wait... 🚀
- Connect to ArgoCD
# download kubeconfig make kube-config # https://localhost:8080 # [admin|<ARGOCD_ADMIN_PASSWORD>] make forward-argocd
- Sample apps
# http://localhost:8090 kubectl --kubeconfig clusters/do-template-kubeconfig.yaml -n examples \ port-forward svc/guestbook-ui 8090:80 # http://localhost:8091 kubectl --kubeconfig clusters/do-template-kubeconfig.yaml -n examples \ port-forward svc/hello-kubernetes-gitops 8091:80
- Alternatively, access the cluster from a container
# use "--network host" to solve dns issues locally or edit "/etc/docker/daemon.json" docker run --rm --name hck-tmp -it \ -e KUBECONFIG=/root/.kube/config \ -v ${PWD}/clusters/do-template-kubeconfig.yaml:/root/.kube/config \ hckops/kube-argo # with docker-compose docker-compose up -d docker exec -it local-hck-template bash docker-compose down -v # login with kubeconfig argocd login --core # list apps kubens argocd kubectl get applications argocd app list # watch resources kubectl klock -n examples pods
- Destroy the cluster
make cluster-down