cd api && go run main.go
cd customersvc && go run main.go
cd greetsvc && go run main.go
docker run -t -d <image>
docker-compose up
Check with:
docker exec -it <container> /bin/bash
wget -q -O - https://raw.githubusercontent.com/rancher/k3d/master/install.sh | TAG=v1.7.0 bash
to install k3dk3d create --api-port 6550 --publish 8090:80 --workers 3
# 80 is the ingress port that traefik listens onexport KUBECONFIG="$(k3d get-kubeconfig --name='k3s-default')"
kubectl cluster-info
kubectl get all -o wide
- For login credentials, see
cat $KUBECONFIG
- Make sure latest images have been built:
docker-compose build
- And have been tagged:
docker tag k8s-tryout-2020_api:latest ggerritsen1/k8s-tryout-2020_api:latest
- And have been pushed:
docker push ggerritsen1/k8s-tryout-2020_api:latest
Then:
kubectl apply -f api-deployment.yaml
Check with:
kubectl get pods -o wide
kubectl logs -f -lapp=k8s-tryout-2020-frontend --all-containers=true --max-log-requests=10
kubectl logs -f -lapp=k8s-tryout-2020-backend --all-containers=true
- Open http://api.localhost:8090/hello to see that it works
- Run bash on a specific container
kubectl exec -it pod/k8s-tryout-2020-api-deployment-54d587f5bf-qqpwv -- /bin/bash
- Run bash on a helper container
kubectl --namespace=default run -it --image=alpine helper-container
, thenwget -SO- k8s-tryout-2020-api/hello
- See traefik dashboard:
kubectl -n kube-system edit configmap traefik
, then add:
[api]
dashboard = true
kubectl -n kube-system port-forward deployment/traefik 8080
and open http://localhost:8080
- Make smaller containers (from scratch)
- Try https://k8slens.dev/
- Add a database
- Add integration with an external endpoint/system
- Docker compose docs
- https://levelup.gitconnected.com/complete-guide-to-create-docker-container-for-your-golang-application-80f3fb59a15e
- https://nickjanetakis.com/blog/docker-tip-10-project-structure-with-multiple-dockerfiles-and-docker-compose
- https://medium.com/burak-tasci/full-stack-monorepo-part-i-go-services-967bb3527bb8
- https://itnext.io/run-kubernetes-on-your-machine-7ee463af21a2
- https://multipass.run/
- https://katacoda.com/courses/kubernetes/playground
- https://github.com/rancher/k3d
- https://medium.com/@zhimin.wen/running-k3s-with-multipass-on-mac-fbd559966f7c
- https://sysadmins.co.za/develop-build-and-deploy-a-golang-app-to-k3s/
- https://medium.com/google-cloud/kubernetes-101-pods-nodes-containers-and-clusters-c1509e409e16
- https://medium.com/google-cloud/kubernetes-110-your-first-deployment-bf123c1d3f8
- https://medium.com/@geraldcroes/kubernetes-traefik-101-when-simplicity-matters-957eeede2cf8
- k3d-io/k3d#103
- k3s-io/k3s#350
- https://rancher.com/docs/k3s/latest/en/installation/kube-dashboard/