Latest Article

This post will explain you about kubernetes services with examples of each types and how it can be implemented with live demo on youtube.

If you are new to kubernetes and want to learn about kubernetes from basics, Refer the below links and also you can checkout all tutorial videos for free on YouTube and do subscribe for more free videos.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

Also You can Watch this Entire Tutorial video with more examples on our YouTube Channel. Make use of it.
[youtube src="d9xx4cfcWUM" height="315" width="560" /]

Lets get started.

Why Kubernetes Service is needed?
You can access your deployed pods only from the worker node where it is running. And it cannot be accessed even from your kubernetes master nodes or from any other nodes until it is exposed through service. Because each pods get its IP address through CNI plugin only from the local host. This is a basic behaviour of pod networking. In Order to access the application over the network, we must use kubernetes service to expose our pods to external traffic and load balancing the traffic across multiple pods.
kubernetes service examples
How we can define the Kubernetes Service?
A Service can be defined in a YAML or JSON file, like all other Kubernetes objects.

Types of Kubernetes Services
These services can be used in different ways based on the types.
[ads-post]
  1. ClusterIP (default) - Exposes the Service on an internal IP in the cluster. This type makes the Service only reachable from within the cluster.
  2. NodePort - Exposes the Service on the same port of each selected Node in the cluster using NAT. Makes a Service accessible from outside the cluster using <NodeIP>:<NodePort>. Superset of ClusterIP.
  3. LoadBalancer - Creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP to the Service. Superset of NodePort.
  4. ExternalName - Exposes the Service using an arbitrary name (specified by externalName in the spec) by returning a CNAME record with the name. 

ClusterIP:
kubernetes clusterip examples
Cluster IP is the default one used only for internal communication within the cluster through service, not to the external traffic. it is very useful when you plan to have architecture like frontend end and backend services. You can use this cluster ip service for your backend pods. its like a private pods, not exposed to public.

NodePort:
kubernetes nodeport examples
Nodeport type exposes your pod to external network with the same target port, so user can access it using worker node ip and port it is exposed. traffic will be send to respective pods through service.

LoadBalancer:
kubernetes loadbalancer examples
But this loadbalancer types works only with cloud provider as of now. If your kubernetes cluster environment is on any cloud provider like google cloud or aws, then if you use the type loadbalancer, you will get an external ip from these provider on behalf of you. so you can access your application using the external ip provided by the provider that will forward the request to the pods. But is is chargeable.

External Name:
kubernetes externalname examples
As the name says, this service used to define the external dns name. lets say you have frontend pod in your cluster that need to access any other application that is outside the cluster and then you can use this service. If your database service is hosted externally and you want to access it within the cluster.

Hope you have got an idea about kubernetes services and why it is needed.

Also refer below related articles and checkout all tutorial videos for free on youtube.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

Keep practicing and have fun. Leave your comments if any.
Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss
Incoming searches: Kubernetes service Explained, Kubernetes service, Kubernetes service basics, Kubernetes service concepts, understanding Kubernetes service, basics of Kubernetes service, Kubernetes service types, types of kubernetes service, Kubernetes service tutorial, Kubernetes service commands, k8s, kubernetes, kubernetes tutorial, Kubernetes service example, Kubernetes service examples, Kubernetes service explained, Kubernetes service explained with examples, kubernetes full tutorial, kubernetes volume explained, kubernetes volumes explained, kubernetes volume local, kubernetes hostpath, real time kubernetes scenario, kubernetes tutorial for beginners, kubernetes beginner tutorial, kubernetes free online tutorial, kubernetes online free tutorial, kubernetes best tutorial, kubernetes videos, kubernetes clusterip service examples, kubernetes nodeport service examples, kubernetes loadbalancer service examples, kubernetes externalname service examples

This post will explain you about Kubernetes Networking concepts and how it helps us for the communication and its types.

Networking in any architecture or technology is very essential to understand if you want to deploy the applications over the network and also understanding how the network works that will  help you to troubleshoot if you have any network issue. So we must know exactly what is happening in the network and how all the connections are establishing for the communication over the network.

If you are new to kubernetes and want to learn about kubernetes from basics, Refer the below links and also you can checkout all tutorial videos for free on YouTube and do subscribe for more free videos.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

Also You can Watch this Entire Tutorial video with more examples on our YouTube Channel. Make use of it.
[youtube src="KtHKSyGzqvo" height="315" width="560" /]

Lets get started.

This is a basic kubernetes architecture where you have some worker nodes, and few pods are running on it with couple of containers.  When you have these many components, how all these components are establishing its connection to make the application accessible over the network.? The answer is that happens only through kubernetes networking.
Kubernetes Networking basics

[ads-post]
Types of Kubernetes Networking

1. Container to Container Communication:
When you have one or more containers within a pod that shares the same host networking. So pods will get its own IP address, All container shares same ip address but it works on different port. Communication between containers happens within the pod itself on different port. So all containers will be able to communicate each other by default.

2. Pod to Pod communication:
As said earlier, Each pods will get its own ipaddress. there are sub types within Pod to Pod communcation, that is.

Intra-node Pod Network - Communication of pods running on a single node.
Inter-node Pod Network - Communication of pods running in different nodes.

On the first case, each pod running on single worker node will have the communication by default, because All ip address of pods will be different and assigned from your local network. since it shares the same host.
On the second case, when you have pod running on multiple worker nodes, communication between these pods happens through network plugin that will create some route tables. It forwards the traffic from any pod to any destination pods.

3. Pod to Service Communication:
Service is kubernetes resource type that expose our application to outside the cluster. Through which pod can send the traffic to services.

4 External to Service Communication:
In order to access our application from outside the cluster, external traffic should be allowed to reach the server within the cluster.. This can be achieved using these different types.
a. ClusterIP
b. NodePort
c LoadBalancer
d. Extername

Each types has its own function and purpose.
Cluster IP - It is the default kubernetes service used for internal communcation within the cluster.
Nodeport - It will open a ports on each nodes and traffic will be forwarded  to the service through random port.
Loadbalancer - It is a type that forwards all external traffic to a service through this type.
External Name - it is a type used to access a service internally that is hosted outside cluster through DNS CName or A record..

Hope you have got an idea about kubernetes networking.

Also refer below related articles and checkout all tutorial videos for free on youtube.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

Keep practicing and have fun. Leave your comments if any.
Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss
Incoming searches: Basics of Kubernetes Networking Explained, kubernetes networking, kubernetes networking basics, kubernetes networking concepts, learn kubernetes networking, basics of kubernetes networking, kubernetes networking types, kubernetes networking tutorial, kubernetes networking commands, k8s, kubernetes, kubernetes tutorial, kubernetes networking example, kubernetes networking examples, kubernetes networking explained, kubernetes networking explained with examples, kubernetes full tutorial, kubernetes volume explained, kubernetes volumes explained, kubernetes volume local, kubernetes hostpath, real time kubernetes scenario, kubernetes tutorial for beginners, kubernetes beginner tutorial, kubernetes free online tutorial, kubernetes online free tutorial, kubernetes best tutorial, kubernetes videos, Understanding Kubernetes Networking

This post will show you how to add new additional worker nodes to existing kubernetes cluster without disturbing running application pods.

If you are new to kubernetes and want to learn about kubernetes from basics, Refer the below links to understand this topic from basics and also you can checkout our all tutorial videos on YouTube for free.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

how to add new worker node to existing kubernetes cluster

Prerequisites of new worker nodes:
1. A New Node with Minimum 2 CPU's with 4Gb Memory is required. Operating system should be installed and ready for the setup, i used Ubuntu 16.04 LTS - 64 Bit.
2. Make sure kubernetes master and new worker node is reachable between each other.
3. Kubernetes doesn't support "Swap". So Disable Swap on new node using below command and also to make it permanent comment out the swap entry in /etc/fstab file.
sudo swapoff -a
4. Internet must be enabled on new node, because required packages will be downloaded from official repository.

Get the Joining Token first from Kubernetes Master Node
Log in to Kubernetes Master node and get the joining token as below.
user1@kubernetes-master:~$ kubeadm token list
If no join token is available, generate new join token using kubeadm command.
user1@kubernetes-master:~$ kubeadm token create --print-join-command
W0331 13:10:57.055398   12062 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
kubeadm join 192.168.2.1:6443 --token jnnu6g.wqbmmc1l2xtdf40t     --discovery-token-ca-cert-hash sha256:ce4c91f6f5442c8c8519cacd4673864f3ce5e466435a6f6ac9e877d1c831f6dc
user1@kubernetes-master:~$ kubeadm token list
TOKEN                     TTL         EXPIRES                     USAGES                   DESCRIPTION  EXTRA GROUPS
jnnu6g.wqbmmc1l2xtdf40t   23h         2020-04-01T13:10:57+05:30   authentication,signing   <none>       system:bootstrappers:kubeadm:default-node-token
Copy the token highlighted in yellow color to join the worker nodes and keep it aside.
[ads-post]
On Worker Nodes, perform the below steps to join the worker nodes.

Update the Ubuntu Repositories and install basic tools like apt-transport-https, curl.
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
Add the Kubernetes Signing Key on new worker nodes.
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Add kubernetes repository on new worker nodes.
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
Install the below required packages on new worker nodes using apt-get command.
sudo apt-get update && sudo apt-get install -y kubelet kubeadm kubectl docker.io
Start and Enable the Docker service on new worker nodes.
sudo systemctl enable docker
Use the Joining token you have copied earlier to add the worker nodes.
user1@kubernetes-worker3:~$ sudo kubeadm join 192.168.2.1:6443 --token jnnu6g.wqbmmc1l2xtdf40t     --discovery-token-ca-cert-hash sha256:ce4c91f6f5442c8c8519cacd4673864f3ce5e466435a6f6ac9e877d1c831f6dc
W0331 14:00:32.775291    7193 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.18" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
user1@kubernetes-worker3:~$
Our new worker node is joined to the cluster successfully as per the above output. Lets login to Kubernetes master and confirm the node list.

On Kubernetes Master:
Verify the list of nodes using kubectl command.
user1@kubernetes-master:~$ kubectl get nodes
NAME                 STATUS   ROLES    AGE   VERSION
kubernetes-master    Ready    master   71m   v1.18.0
kubernetes-worker1   Ready    <none>   69m   v1.18.0
kubernetes-worker2   Ready    <none>   69m   v1.18.0
kubernetes-worker3   Ready    <none>   59m   v1.18.0
That's it, Above output shows our newly added worker nodes.

Keep practicing and have fun. Leave your comments if any.

Also refer below articles and checkout all tutorial videos on youtube.

What is Kubernetes - Learn Kubernetes from Basics
How to Install Kubernetes on Linux (RedHat / CentOS)
How to Install Kubernetes On Ubuntu 16.04 LTS
How to Create Kubernetes Deployment, Services & Pods Using Kubectl
How to Create Kubernetes YAML for Deployment, Service & Pods
Kubernetes Volumes Explained with Examples
Kubernetes Persistent Volumes and Claims Explained

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss
Incoming searches: add worker node to kubernetes, kubernetes add node to existing cluster, kubeadm add node, kubeadm join token, generate join token, how to add new worker nodes to kubernetes, add additional nodes to kubernetes, how to add worker node to master in kubernetes, how to add worker node in kubernetes, kubernetes add worker node, join new worker node to kubernetes cluster, adding new worker node to kubernetes cluster, join new worker nodes with kubernetes cluster, add more nodes to kubernetes cluster, add nodes to kubernetes cluster, how to add nodes to kubernetes cluster, add new node to kubernetes cluster, kubernetes full tutorial, real time kubernetes scenario, kubernetes tutorial for beginners, kubernetes beginner tutorial, kubernetes free online tutorial, kubernetes online free tutorial, kubernetes best tutorial, kubernetes videos


Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget