{"id":16721640,"url":"https://github.com/zoltan-nz/playing-with-kubernetes","last_synced_at":"2025-04-10T10:06:32.542Z","repository":{"id":144596603,"uuid":"104638811","full_name":"zoltan-nz/playing-with-kubernetes","owner":"zoltan-nz","description":"Getting started with kubernetes, tutorial for beginners, kubernetes tutorial","archived":false,"fork":false,"pushed_at":"2025-02-12T19:26:23.000Z","size":36,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T08:55:18.644Z","etag":null,"topics":["kubernetes","minikube","tutorial"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoltan-nz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-24T11:26:24.000Z","updated_at":"2022-09-27T06:02:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"979581f3-3c3d-4520-915b-54b4ab1a8dad","html_url":"https://github.com/zoltan-nz/playing-with-kubernetes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoltan-nz%2Fplaying-with-kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoltan-nz%2Fplaying-with-kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoltan-nz%2Fplaying-with-kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoltan-nz%2Fplaying-with-kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoltan-nz","download_url":"https://codeload.github.com/zoltan-nz/playing-with-kubernetes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198880,"owners_count":21063628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","minikube","tutorial"],"created_at":"2024-10-12T22:31:39.584Z","updated_at":"2025-04-10T10:06:32.520Z","avatar_url":"https://github.com/zoltan-nz.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Playing with Kubernetes\n\nThe following instruction is mainly relevant for macOS.\n\n## Getting started with Kubernetes\n\n- [Install Docker for Mac with Kubernetes support](https://docs.docker.com/docker-for-mac/install/)\n\n## Readings\n\n- [The Illustrated Children’s Guide to Kubernetes](https://www.cncf.io/the-childrens-illustrated-guide-to-kubernetes/)\n- [Concepts](https://kubernetes.io/docs/concepts/)\n- [Tutorial](https://kubernetes.io/docs/tutorials/)\n- [Technical details about Docker and Kubernetes for Mac](http://collabnix.com/how-docker-for-mac-works-under-the-hood/)\n\n## Setup WebUI(Dashboard) or Use Octant\n\n- [Dashboard README](./kubernetes-configurations/dashboard/README.md)\n- [Octant](https://octant.dev/)\n\n```bash\n$ brew install octant\n$ octant\n```\n\n## Console based manager tool k9s\n\n- Install [k9s](https://k9scli.io/topics/install/)\n\n```\nbrew install derailed/k9s/k9s\n```\n\n## Using Waveworks Scope\n\n- [Scope](https://github.com/weaveworks/scope)\n\n```bash\nkubectl apply -f \"https://cloud.weave.works/k8s/scope.yaml?k8s-version=$(kubectl version | base64 | tr -d '\\n')\"\nkubectl port-forward -n weave \"$(kubectl get -n weave pod --selector=weave-scope-component=app -o jsonpath='{.items..metadata.name}')\" 4040\n```\n\nOpen: http://localhost:4040\n\n## Getting information about your cluster and nodes\n\n```bash\n$ kubectl cluster-info\n$ kubectl get nodes\n```\n\n## Monitoring\n\n- [cAdvisor Kubernetes Daemonset](https://github.com/google/cadvisor/tree/master/deploy/kubernetes)\n- [Prometheus](https://prometheus.io/docs/prometheus/latest/installation/)\n\n## Helm\n\n```\nbrew install helm\nhelm init --service-account tiller\n```\n\n## Deployment\n\n[Source](https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-intro/)\n\n### Let's create our simple application in Node.js\n\n- Check `./hello-world-app` folder.\n- Check `./hello-world-app/Dockerfile`.\n\n```\n$ docker build -t zoltannz/kubernetes-app.\n$ docker run -p 3000:3000 zoltannz/kubernetes-app\n$ docker push zoltannz/kubernetes-app\n```\n\n### Deploy\n\n```\n$ kubectl get nodes\n$ open localhost:8001\n$ kubectl run hello-world --image=zoltannz/kubernetes-app --port=3000\n```\n\n- searched for a suitable node where an instance of the application could be run (we have only 1 available node)\n- scheduled the application to run on that Node\n- configured the cluster to reschedule the instance on a new Node when needed\n- Check pods on Dashboard.\n- Deploy container with GUI.\n\n```bash\n$ kubectl get deployments\n```\n\n- Kubernetes run pods in an isolated network, we have to open it up.\n\n```\n$ kubectl proxy\n$ open http://localhost:8001/api/v1/proxy/namespaces/default/pods/hello-world-542297729-zc06m/\n```\n\nPlaying with our deployed containers:\n\n```bash\n$ kubectl get\n$ kubectl describe\n$ kubectl logs\n$ kubectl exec\n```\n\nExpose to public:\n\n```bash\n$ kubectl get services\n$ kubectl expose deployment hello-world --type=NodePort --port 3000\n$ minikube service hello-world\n```\n\nRunning command inside in our Pod container\n\n```\n$ kubectl exec -ti hello-world-4149272534-4627k /bin/sh\n```\n\n### Namespace\n\nCreate namespace for `the-pipeline`:\n\n```\nkubectl create namespace the-pipeline\n```\n\nCreate `the-pipeline` context for the `the-pipeline` namespace.\n\n```\nkubectl config set-context the-pipeline --namespace=the-pipeline\n```\n\n## Minikube\n\nPrerequisites:\n\n- [Setup loopback alias and `dnsmasq`](https://github.com/zoltan-nz/playing-with-gitlab#setup-dnsmasq-with-loopback-alias).\n- [Install `hyperkit` driver](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#hyperkit-driver).\n\n```shell\nbrew install hyperkit\nbrew install docker-machine-driver-hyperkit\n```\n\n- [Turn on DHCP client on `dnsmasq`](https://wiki.archlinux.org/index.php/dnsmasq).\n\nTrying to create a new docker-machine but `dnsmasq` dhcp options not picked up.\n\n```shell\ndocker-machine create --driver hyperkit --engine-opt dns=10.254.254.254\n```\n\nAdd `listen-address=192.168.64.1` to `dnsmasq.conf`. But it works only if the cluster already started.\n\n```\nbrew install kubernetes-cli\nbrew cask install minikube\n```\n\nStart minikube with `hyperkit` VM, custom domain name, custom cpu number, and hard drive allocation.\n\n```\nminikube start --vm-driver hyperkit --dns-domain \"minikube.loc\" --cpus 4 --memory 6114 --disk-size 64g\n```\n\n## Kubernetes vs Openshift\n\n- [10 most important differences between OpenShift and Kubernetes](https://cloudowski.com/articles/10-differences-between-openshift-and-kubernetes/)\n\n## Create a Registry in Minikube\n\n- \u003chttps://blog.hasura.io/sharing-a-local-registry-for-minikube-37c7240d0615/\u003e\n\n## Kubernetes Cheat Sheet\n\n- \u003chttps://kubernetes.io/docs/reference/kubectl/cheatsheet/\u003e\n\n## Using MicroK8s with Multipass on macOS\n\n- Useful article: \u003chttps://itnext.io/microk8s-on-macos-98f1de3aa63e\u003e\n- Article from Ubuntu: \u003chttps://ubuntu.com/blog/kubernetes-on-mac-how-to-set-up\u003e\n- MicroK8s: \u003chttps://microk8s.io/#quick-start\u003e\n- Multipass: \u003chttps://multipass.run/\u003e\n\nInstall Multipass Ubuntu virtual machine runner tool with brew:\n\n```\nbrew cask install multipass\n```\n\nRun a virtual machine. The following command will create a vm with 100G disk, 16G memory and 8 cores CPU.\n\n```\nmultipass launch -n primary -c 8 -d 100G -m 16G\nmultipass exec primary -- sudo apt update -y \u0026\u0026 sudo apt dist-upgrade -y\nmultipass exec primary -- sudo snap install microk8s --classic\nmultipass exec primary -- sudo usermod -a -G microk8s multipass\nmultipass exec primary -- sudo iptables -P FORWARD ACCEPT\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoltan-nz%2Fplaying-with-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoltan-nz%2Fplaying-with-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoltan-nz%2Fplaying-with-kubernetes/lists"}