Skip to content

rawadhossain/Kubernetes

Repository files navigation

Kubernetes notes

A hands-on Kubernetes practice repository used as a personal reference.

It includes tested YAML manifests and notes created while learning and experimenting with core Kubernetes concepts. Each folder focuses on a specific topic and reflects real configurations I applied to understand Kubernetes internals and workflows.

Terminology

  • Node: A worker machine in Kubernetes, part of a cluster.
  • Cluster: A set of Nodes that run containerized applications managed by Kubernetes.
    • For this example, and in most common Kubernetes deployments, nodes in the cluster are not part of the public internet.
  • Edge router: A router that enforces the firewall policy for your cluster.
    • This could be a gateway managed by a cloud provider or a physical piece of hardware.
  • Cluster network: A set of links, logical or physical, that facilitate communication within a cluster according to the Kubernetes networking model.
  • Service: A Kubernetes Service that identifies a set of Pods using label selectors.
    • Unless mentioned otherwise, Services are assumed to have virtual IPs only routable within the cluster network.

Concepts


Permanent alias kubectl in PowerShell

In PowerShell, type the following command:

notepad $PROFILE

Open notepad and save this command:

Set-Alias -Name k -Value kubectl

Now can use "k" as kubectl

Commands

Create Deloyment

kubectl create -f deployment.yml

Get Deloyment

k get deployments

Update Deloyment

k set image deployment/fitness-app mysql=mysql:8.0

Status of Deloyment

k rollout status deployment/fitness-app
k rollout history deployment/fitness-app

Rollback Deloyment

k rollout undo deployment/fitness-app

Kubernetes Commands

kubectl

Kubectl is a Command line tool for communicating with a Kubernetes cluster.

Kubernetes version running on nodes

k version

Number of nodes

k get nodes

Command to create a pod and deploy docker container in PODs

k run mysql --image mysql

List of PODS in Cluster

k get pods

Get information about POD

k describe pod mysql

Additional Information about POD

k get pods -o wide

Create POD using pod-definition.yml file

k create -f pod-definition.yml

Delete Pod

k delete pod pod-name

Edit Pod

k edit pod pod-name

pod-definition.yml

Kubernetes uses yml file as an input to create pods, replicas, deployments, services and so on,

The yml files contain four top level fields-

  • apiVersion: Depending on what we need to create use apiVersion, for creating pods use version v1
  • kind: Type of object we want to create such as Pod
  • metadata: Data about the object like name, labels and app.
  • spec: Specification

Create replica sets

k create -f replicaset.yml

Get replica sets

k get replicaset

Delete replica sets

k delete replicaset replicaset-name

Replace replica sets

k replace -f replicaset.yml

Scale replica sets

k scale -replicas=6 -f replicaset.yml

About

Kubernetes core concepts demonstrated through organized and tested YAML manifests, including networking, configuration, storage, and scaling resources.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors