Content

                                                  Content How to create an AWS free Account? Lab 1: To launch amazon Linux EC2 instance Lab 2: To Connect to the instance from Linux client Operating System Lab 3:To Launch amazon windows instance Lab 4: Installing apache in EC2 instance Lab 5: Installing Nginx in EC2 instance Lab 6: Changing Host Name Lab 7: Creating a user and making as a sudoer Lab 8:Assigning an Elastic ip Lab 9:Creating ebs,attach and detach the volumn to the instance Lab 10:Creating an S3 Bucket and creating cross replication in another region Lab 11:Load Balancer Lab 12:Two instances with Application Load Balancer Lab 13:Launching two instances with load Balancer Lab:14 Creating Own VPC  Lab 15: Two instances which classic load Balance with own VPC Lab 16:Two instances with Application load Balancer with own VPC Lab 17: Relational Data B...

Lab 29 : kubernetes

                                                                 kubernetes

What is k8 and why we use?

Kubernetes or K8 for short is open source tool kit for building a fault- tolerant ,scalable platform design to automate and centrally manage containerized applications the platform it self can be deployed within almost any infrastructure –in the local network ,server cluster data center any kinds of cloud –public (google cloud and micro soft azure,AWS etc), private hybrid ,or even over the combination of these methods it note worthy that Kubernetes supports the automatic placements and replication of containers over a large number of hosts

By default , Kubernetes uses docker to run images and manage containers nevertheless ,K8 can use other engines ,for example ,rkt from the core OS in general Kubernetes is an easier-to-configure, more mature and functionally rich analog to Dockers swarm .

some keywords:

Master and Slave

kuberproxy

scheduler

kubelet

Api-server

Etcd

Controller

Demon set

Deployment

Service

Ingress

Config map

Replication controller

Kubernetes lab:

Pre-quest:

Install an instance for K8 master

Install k8

Install docker

Step 1: launch an instance

Refer above how to launch an instance

 

Login to the server

And install the Kubernetes

 

Enable the epel for Kubernetes

Cat<<EOF> /etc/yum.repos.d/kubrenetes.repo

[kubernetes]

Name= kubernetes

Baseurl =http://yum.kubernetes.io/.io/repos/kubernetes-e17-x86_64

Enabled=1

Gpgcheck=1

Repo_ Gpgcheck=1

Gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg

https:// packages.cloud.google.com/yum/doc/rpm –package-key.gpg

EOF

 

#yum update-y


Install the kubernetes

# yum install kubeletkubeadmkubectlkkubernetes-cni-y-nogpgcheck

 


Start and Enable the kubernetes

#systemctl enable kubelet

#systemctl start kubelet

 


Disable the selinux

#vi/etc/selinux/config

Go to vi editor and the line and Enter disable

 

Go to 7th line and Edit selinux=disabled

 

Install the docker

Enable the EPEL for docker and then install docker

#yum install docker  -y

 


Systemctl Start docker

Systemctl Enable  docker

 

 

Run the below commands

Sysctl –w net.bridge.bridge –nf-call-iptables=1

Echo “net.bridge.bridge –nf-call-iptables=1”>/etc/sysctl.d/k8s.conf

 


Now  Restart the instance

Go to the instance

Select the install click on actions Reboot the service

 

 

Now take the ami of the service

Select the instance go the actions

Click on image there click on create image

 



Click on create image

 


Now from the image launch 2 instances for k8 slaves


 

Click on launch and launch instance







Add click on launch

 



Login to the k8 master slave

Run the command

#kubeadminit

 

Copy  the token id

And cluster info

Mkdir –p $HOME/.kube

Sudocp –i/etc/kubernetes/admin.conf$HOME/.kube/config

Sudochown $(id-u):$(id –g)$HOME/.kube/config

Kubeadmin join 172.31.27.254:6443 –token 81uegf.53p1zde3sln5dhu6 –discovery-token-ca-cert-hash-sha256:8c8122ead3953bd416170da430ac6164aaa8878379add3ad4cc2c595dd8f13

Now run the following commands:

#mkdir –p $HOME/.kube

#sudocp –i/etc/kubernetes/admin.conf $HOME/.kube/config

#sudochown $(id –u):$(id –g) $HOME/.kube/config

 


Now run the command in master

#kubectl get nodes

 

Now run the below commands in master

Exportkubever=$(kubectl version|base64|tr –d’\n’)

Kubectl apply –f https://cloud.weave.works/k8s/net?k8s-version=$kubever


 

Now login to slave 1

 

Run token id

 


Run the same token id in slave 2 server

Login to slave 2 server

 


You can run the pods in slave.


Comments

Popular posts from this blog

Lab 21:Installing docker in instance and build an image

Lab 22:Pushing a docker image to docker hub

Lab 5: Installing Nginx in EC2 instance