Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kubernetes-basicLearning

> 编程语言
Open source

Understand kubernetes step by step. A simple repo for beginners :fire:

2.3K stars0 likes2 views
WebsiteGitHub

About

Understand kubernetes step by step. A simple repo for beginners :fire:

This is just a simple demonstration to get a basic understanding of how Kubernetes works while working step by step. I learnt Kubernetes like this and made this repo to solve some problems that I faced during my learning experience so that it might help other beginners. We won't be going into depth about Docker :blush: but will see sufficient content to get you a basic understanding to learn and work with Kubernetes. :v: Hope you enjoy learning. If you like it please give it a :star2:.

Important :- By seeing size of the readme, you might have second thoughts. But to be honest, if you work from start to finish, you won't experience any problem and learn along the way.

Contents

  • Requirements
  • Docker
    • What is Docker?
    • Creating a web server
    • Building Docker Image
    • Getting Docker images
    • Running the container image
    • Accessing your application
    • Listing all your running containers
    • Running a shell inside an existing container
      • Exploring container from within
    • Stopping and removing a container
    • Pushing the image to an image registry
      • Pushing image to Docker hub
  • Kubernetes
    • What is Kubernetes
      • Splitting apps into microservice
      • Scaling Microservices
      • Deploying Microservices
    • Working with Kubernetes
    • Setting up a Kubernetes cluster
    • Running a local single node Kubernetes cluster with Minikube
      • Starting a Kubernetes cluster with minikube
    • Checking Status of cluster
    • Deploying your Node app
    • Listing Pods
    • Accessing your web application
      • Creating a service object
      • Listing Services
    • Horizontally scaling the application
      • Increasing the desired Replica count
      • Seeing the result of the Scale Out
    • Displaying the Pod IP and Pods Node when listing Pods
    • Accessing Dashboard when using Minikube
    • Pods
      • Examining a YAML descriptor of an existing pod
      • Introducing the main parts of a POD definition
      • Creating a simple YAML descriptor for a pod
      • Using kubectl create to create the pod
      • Retrieving a PODs logs with Kubectl logs
      • Forwarding a Local Network to a port in the Pod
      • Introducing labels
        • Specifying labels when creating a pod
        • Modifying labels of existing pods
      • Listing subsets of pods through label selectors
        • Listing pods using a label selector
        • Using multiple conditions in a label selector
      • Using labels and selectors to constrain pod scheduling
        • Using labels for categorizing worker nodes
        • Scheduling pods to specific nodes
        • Scheduling to one specific node
      • Annotating pods
        • Looking up an objects annotations
        • Adding and modifying annotations
      • Using namespace to group resources
        • Discovering other namespaces and their pods
        • Creating a namespace
        • Managing objects in other namespaces
        • Understanding the isolation provided by namespaces
      • Stopping and removing pods
        • Deleting a pod by name
        • Deleting pods using label selectors
        • Deleting pods by deleting the whole namespace
        • Deleting all pods in namespace, while keeping the namespace
        • Delete almost all resources in namespace
      • Replication and other controllers: Deploying managed pods
        • Keeping pods healthy
        • Introducing liveness probes
        • Creating an HTTP based liveness probe
        • Seeing a liveness probe in action
        • Configuring additional properties of liveness probe
        • Creating effective liveness probe
      • Introducing ReplicationControllers
        • The operation of a ReplicationController
        • Introducing the controller reconciliation loop
        • Creating a ReplicationController
        • Seeing the ReplicationController in action
        • Understanding exactly what caused the controller to create a new pod
        • Moving pods in and out of the scope of a ReplicationController
        • Changing the pod template
        • Horizontally scaling pods
        • Deleting a ReplicationController
      • Using ReplicaSets instead of ReplicationControllers
        • Defining a ReplicaSet
        • Using the ReplicaSets more expressive label selectors
      • Running exactly one pod on each node with DaemonSets
        • Using a DaemonSet to run a pod on every node
        • Explaning Daemon sets with an example
        • Creating the DaemonSet
      • Running Pod that perform a single completable task
        • Introducing the Job resource
        • Defining a Job resource
        • Seeing a Job run a pod
  1. Todo

Requirements

You need to:

  • have Docker installed for your OS;
  • minikube installed for running locally; and
  • kubectl installed.

Simple concepts before we start

What is Docker

Docker is a platform for packaging, distribution and running applications. It allows you to package your application together with its whole environment. This can be either a few libraries that the app requires or even all the files that are usually available on the filesystem of an installed operating system. Docker makes it possible to transfer this package to a central repository from which it can then be transferred to any computer running Docker and executed there.

Three main concepts in Docker comprise this scenario:

  • Images :— A Docker based container image is something you package your application and its environment. It contains the filesystem that will be available to the application and other metadata, such as the path to the executable that should be executed when the image is run.
  • Registries :- A Docker Registry is a repository that stores your Docker images and facilitates easy sharing of those images between different users and computers. When you build your image, you can either run it on the computer you’ve built it on, or you can push (upload) the image to a registry and then pull (download) it on another computer and run it there. Certain registries are public, allowing anyone to pull images from it, while others are private, only accessible to certain people or machines.
  • Containers :- A Docker-based container is a regular Linux container created from a Docker-based container image. A running container is a process running on the host running Docker, but it’s completely isolated from both the host and all other processes running on it. The process is also resource-constrained, meaning it can only access and use the number of resources (CPU, RAM, and so on) that are allocated to it.

Learning while working

Creating a web server

You first need to create a container image. We will use Docker for that. We are creating a simple web server to see how Kubernetes works.

  • create a file app.js and copy this code into it
javascript
const http = require('http');
const os = require('os');
console.log("Kubia server starting...");
var handler = function (request, response) {
  console.log("Received request from " + request.connection.remoteAddress);
  response.writeHead(200);
  response.end("You've hit " + os.hostname() + "\n");
};
var www = http.createServer(handler);
www.listen(8080);

Now we will create a Docker file that will run on a cluster when we create a Docker image.

  • Create a file named Dockerfile and copy this code into it.
dockerfile
FROM node:8 

RUN npm i

ADD app.js /app.js

ENTRYPOINT [ "node", "app.js" ]

Building Docker Image

Make sure your Docker server is up and running. Now we will create a Docker image in our local machine. Open your terminal in the current project's folder and run

docker build -t kubia .

You’re telling Docker to build an image called kubia based on the contents of the current directory (note the dot . at the end of the build command). Docker will look for the Dockerfile in the directory and build the image based on the instructions in the fi

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言