{"id":19805750,"url":"https://github.com/shekhargulati/the-k8s-internals","last_synced_at":"2026-02-28T05:44:08.829Z","repository":{"id":139474860,"uuid":"172241994","full_name":"shekhargulati/the-k8s-internals","owner":"shekhargulati","description":"Kubernetes Internals (Learning from source)","archived":false,"fork":false,"pushed_at":"2019-02-23T17:50:15.000Z","size":108,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-22T05:04:47.437Z","etag":null,"topics":["guide","kubernetes","tutorial"],"latest_commit_sha":null,"homepage":"","language":null,"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/shekhargulati.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,"zenodo":null}},"created_at":"2019-02-23T17:25:30.000Z","updated_at":"2023-09-01T10:45:41.000Z","dependencies_parsed_at":"2023-07-06T18:32:20.699Z","dependency_job_id":null,"html_url":"https://github.com/shekhargulati/the-k8s-internals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shekhargulati/the-k8s-internals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekhargulati%2Fthe-k8s-internals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekhargulati%2Fthe-k8s-internals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekhargulati%2Fthe-k8s-internals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekhargulati%2Fthe-k8s-internals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shekhargulati","download_url":"https://codeload.github.com/shekhargulati/the-k8s-internals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shekhargulati%2Fthe-k8s-internals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29925754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["guide","kubernetes","tutorial"],"created_at":"2024-11-12T09:05:09.393Z","updated_at":"2026-02-28T05:44:08.797Z","avatar_url":"https://github.com/shekhargulati.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Kubernetes Internals\n\nI am on a journey to learn Kubernetes internals by reading and understanding its source code. I am sharing my notes in this repository. If you find this useful then you can star this repository. \n\n\u003e I am unfamiliar with Go so I might post something basic about it as well.\n\u003e\n\u003e This guide assumes that you already know Kubernetes basics.\n\n## Section 1: Building Kubernetes source code on Mac\n\nThe first thing that we need to do before we can start learning about Kubernetes is to build its source code. Following are the steps that I took to build Kubernetes source code.\n\n## Step 1: Install Docker for MacOS\n\nDownload and install Docker for MacOS\n\n## Step 2: Install Go\n\nI recommend you install the latest version of Go using brew package manager\n\n```\nbrew install go\n```\n\nIf you already have previously installed Go version then you can upgrade that using `brew upgrade go`\n\n## Step 3: Create Go workspace\n\nCreate a directory that you want to use as workspace\n\n```\nmkdir bin pkg src\n```\n\nSet GOPATH environment variable as well\n\n## Step 4: Get the latest Go code\n\n```\ngo get -d k8s.io/kubernetes\n```\n\n## Step 5: Install gnu-tar \u0026 gnu-sed\n\n```\nbrew install gnu-tar gnu-sed\n```\n\n## Step 6: Run quick-release\n\n```\ntime make quick-release\n```\n\nOn my machine, it took close to 20 mins for the above command to finish.\n\n```\nmake quick-release  119.52s user 22.08s system 11% cpu 20:45.34 total\n```\n\n## Section 2: What happens when you run `kubectl create -f pod.yaml`?\n\n`kubectl` is a command-line that we use to create Kubernetes objects like pod. Pod is the smallest object that you can create or deploy. So, we will start by understanding how different Kubernetes components interact to create the pod.\n\nWe can create a simple pod by using following manifest file `pod.yaml`\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: hello-world\n  labels:\n    name: hello-world\nspec:\n  containers:\n  - name: hello-world\n    image: petegoo/node-express-sample\n    resources:\n      limits:\n        memory: \"128Mi\"\n        cpu: \"500m\"\n    ports:\n      - containerPort: 80\n```\n\nTo create a pod, we will run the following command.\n\n```\n$ kubectl create -f pod.yaml\npod \"hello-world\" created\n```\n\n```\n$ kubectl get pod\nNAME          READY     STATUS              RESTARTS   AGE\nhello-world   0/1       ContainerCreating   0          6s\n```\n\n```\n$ kubectl get pod --watch\nNAME          READY     STATUS              RESTARTS   AGE\nhello-world   0/1       ContainerCreating   0          14s\nhello-world   1/1       Running   0         1m\n```\n\n### High level overview\n\nLet's look at the high level overview of how different Kubernetes interact with each other to create a pod.\n\n![](images/k8s-create-pod.png)\n\n1. User uses `kubectl` client to create a pod by typing `kubectl create -f pod.yaml`\n2. `kubectl` uses it deserialisation and serialisation machinery to convert YAML to JSON. \n3. Kubectl makes an HTTP POST request to `apiserver`\n4. The `apiserver` receives the request, validate it, and store the resource in etcd. Only `apiserver` talks to etcd, all other components talk to `apiserver` to perform any action with data store.\n5. `scheduler` subscribes to `apiserver` by opening a HTTP connection. `apiserver` sends notification to the scheduler for creation of new pod\n6. `scheduler` uses its scheduling algorithm to find the best possible node that should run the pod. `scheduler` does not do the actual task of running the pod. It only changes the state of the pod by specifying the node that should run the pod\n7. The work to run the process on the worker node is performed by `kubelet`. Like `scheduler`, kubelet also subscribe to changes by opening an HTTP connection to `apiserver`.\n8. When `kubelet` receives a notification for a new pod then it uses Pod specification to start a new container using the container runtime that Kubernetes is uses.\n\nNow, that we have a high level understanding on how different components interacted with each other to create the pod we can now start digging into the code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshekhargulati%2Fthe-k8s-internals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshekhargulati%2Fthe-k8s-internals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshekhargulati%2Fthe-k8s-internals/lists"}