GithubHelp home page GithubHelp logo

kubelearn's Introduction

Kubernetes notes

Kubernetes architecture

Kubernetes is consists of following components -

Master

  • ApiServer - to communicate with kube cluser
  • etcd - distributed key-value store info about cluster nodes
  • controller - brain of orchestration
  • scheduler - schedule running of pods on nodes

Worker

  • kubelet - communicate with master to send status of the node
  • container runtime - run container(in our case docker)

Config file format

yaml file format for kube config files have following sections -

apiVersion:
kind:
metadata:
spec:  

Container

Running instance of docker image which is sharing host OS core with other processes but is having its own OS packages to run the code(Ubuntu packages and libraries in case we are running Ubuntu docker image).

type Container struct {
    Environemnt ownEnv // with required packages and libs
    OSKernal sharedHostOSKernal // host OS kernal is shared 
}

Pod

Logical kubernetes objects which are responsible for running containers.

Usually, 1 pod is dealing with 1 container but we can have pods with mutliple containres called multicontainer pod. These contains main container and helper containers for the main container.

just for example -

type Pod struct {
    Container mainContainer
    Container helperContainer // in case of multi container pods only
}

commands -

kubectl run nginx --image nginx

kubectl get pod

kubectl create -f pod/pod-definition.yaml  

kubectl describe pod myapp-pod

kubectl delete pod myapp-pod

Replication Controller

Logical kubernetes object to handle load balancing & scaling,high availability of Pods. It ensures particular no of Pods are running as per the replicas set.

Just for example -

type ReplicationController struct {
    Template podTemplate
    Replicas int // no of replicas for above mentioned pod
}

commands -

kubectl create -f replication-controller/rc-config.yaml
kubectl get rc
kubectl scale --replicas=8 -f replication-controller/rc-config.yaml
kubectl scale --replicas=8 rc rc-nginx
kubectl edit rc rc-nginx
kubectl delete rc rc-nginx

Replica Set

It is similar to replication controller object to handle load balancing & scaling,high availability of Pods. It ensures particular no of Pods are running as per the replicas set. It has added feature called selector which is being used to check if particular pods are already running, if yes then these pods will be added to replica set. Only pods without parents(replicaSet or replicationController) will be matched.

Just for example -

type ReplicaSet struct {
    Template podTemplate
    Replicas int // no of replicas for above mentioned pod
    Selector podSelector // match particular pods to be added to replica set
}

commands -

kubectl create -f replica-set/rs-config.yaml
kubectl get rs
kubectl scale --replicas=8 -f replica-set/rs-config.yaml
kubectl scale --replicas=8 rs rs-nginx
kubectl edit rs rs-nginx
kubectl delete rs rs-nginx

Deployment

Kubernetes object for handling deployments of replica sets. The main use cases of deployment is as follows -

  • Rollout replica sets
  • Deploy the new state of pods
  • Rollback to an earlier version
  • Pause the deployments
  • Use the status of the deployment
  • Clean up older replica sets

Just for an example -

type Deployment struct {
    Template podTemplate
    Replicas int // no of replicas for above mentioned pod
    Selector podSelector // match particular pods to be added to replica set
}

commands -

kubectl create -f deployment/deployment.yaml --record=true
kubectl get deployment
kubectl rollout status deployment nginx-deployment
kubectl rollout history deployment nginx-deployment
kubectl rollout undo deployment nginx-deployment --to-revision=2
kubectl scale --replicas=6 deployment nginx-deployment
kubectl delete deployment nginx-deployment

kubelearn's People

Contributors

ganeshdipdumbare avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.