In this post I will explain how to setup a minikube single node kubernetes cluster using AWS EC2 instance which would help anyone who is trying to learn kubernetes and also help them to gain practical knowledge in kubernetes by running kubernetes commands, creating kubernetes objects etc.
Minikube is a single node kubernetes cluster which means a kubernetes cluster with only one node that is a single VM.
Minikube is only used for learning purposes and it is not an alternative for a real kubernetes cluster and should not be used for development and production usage.
In this example I have launched an AWS EC2 instance with below configuration where I will install minikube and related tools.
AWS EC2 Instance Configuration
AMI: Ubuntu Free tier eligible 64 bit
Instance type : t2-large ( For me t2-small or t2-micro is giving performance issues due to less memory)
Once the EC2 instance is up and running, login to the instance using below command on terminal. If you are using windows OS then use Putty or git bash or any tools like that.
ssh -i "my.pem" ubuntu@xxxxx.ca-central-1.compute.amazonaws.com
Step 1: Install kubectl
kubectl is a tool that you can use to execute kubernetes commands on the cluster to create and
monitor resources. Run below command.
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
Provide execute permission:
chmod +x kubectl
Move it to /usr/local/bin:
sudo mv kubectl /usr/local/bin/kubectl
Step 2: Install Docker runtime
kubernets is a container orchestration tool and we would need to install a container run time such as docker or rkt etc. Here we are going to install docker.
Install Docker:
sudo apt-get update && sudo apt-get install docker.io -y
Verify Docker:
docker --version
Step 3: Install Minikube
Run below command:
curl -LO minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
Move it to /usr/local/bin:
sudo install minikube /usr/local/bin/
Start minikube:
sudo minikube start --driver=none
If you get an error as below,
The none driver requires conntrack to be installed for kubernetes version 1.18.0
Install conntrack:
sudo apt-get -qq -y install conntrack
Try to Start minikube again:
sudo minikube start --driver=none
If successfull then you will see a message as below:
Done! kubectl is now configured to use "minikube"
Now verify our minikube cluster by running a kubectl command:
sudo kubectl get nodes
If everything configured correctly then you will see:
ubuntu@XXX:~$ sudo kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-31-10-105 Ready master 40m v1.18.0
Step 4: Create and verify kubernetes deployment
Create a deployment with a pod running nginx container:
sudo kubectl create deployment nginx --image=nginx
Verify the deployment and all resources created:
kubectl get all
ubuntu@ip-172-31-10-105:~$ k get all
NAME READY STATUS RESTARTS AGE
pod/nginx-f89759699-zzfj9 1/1 Running 0 72
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 52m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx 1/1 1 1 72
NAME DESIRED CURRENT READY AGE
replicaset.apps/nginx-f89759699 1 1 1 72s
If you want to save some typing then create an alias for "sudo kubectl":
alias k=sudo kubectl
then instead of "sudo kubectl" type just k as below:
k get all
ubuntu@ip-172-31-10-105:~$ k get all
NAME READY STATUS RESTARTS AGE
pod/nginx-f89759699-zzfj9 1/1 Running 0 4m58s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 56m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx 1/1 1 1 4m58s
NAME DESIRED CURRENT READY AGE
replicaset.apps/nginx-f89759699 1 1 1 4m58s
Now your learning environment has been setup. Have a good learning experience! Please let me know your comments.
Thanks for sharing this wonderful content.its very useful to us.
ReplyDeleteI gained many unknown information, the way you have clearly explained is really fantastic.
oracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! online outsourced bookkeeping services
ReplyDeleteThe look rightly terrific. All these mini advice happen to be created implementing massive amount past working experience. I'd like to see the whole works very much. Smart contract development Pune
ReplyDeleteThis is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.
ReplyDeleteCustom MLM Software jaipur
wow excellent blog thanks for sharing...Smart contract development company mirzapur
ReplyDeleteGreat Post…This Article is very unique. Thanks for sharing and very informative!!!MLM Software Development Company Mumbai
ReplyDeleteThis is an very amazing blog keep going and keep sharing!!crypto exchange software development mumbai
ReplyDeleteThanks for sharing very awesome blog.
ReplyDeleteERC20 Token Developer in Mumbai
i really try these steps its very helpful to me , thanks for this amazing blog .... ERC20 TOKEN DEVELOPMENT COMPANY IN CHICAGO
ReplyDeleteIn the event that your business has any online parts (like a site), SEO is urgent to the progressing achievement of your business.SEO Antwerpen
ReplyDeleteThis is article is very unique and very Informative.
ReplyDeleteCRYPTOCURRENCY EXCHANGE DEVELOPMENT Company
This post is really nice thanks for it keep posting.
ReplyDeleteSMART CONTRACT SOFTWARE DEVELOPMENT
It is unique and inspiring article.
ReplyDeleteANIMATION VIDEO MAKERS IN INDIA
Great Post…This Article is very unique. Thanks for sharing and very informative!!gupt rog in Allahabad
ReplyDeleteReally an awesome post.I wondered by reading this post.gupt rog doctors in allahabad
ReplyDeletewow excellent blog thanks for sharing..Best Sexologist in Prayagraj
ReplyDeletei really try these steps its very helpful to me , thanks for this amazing blog ...sexologist Doctors
ReplyDeleteThis post is really nice thanks for it keep posting.Sexologist in Allahabad
ReplyDeleteExcellent post. I certainly appreciate this website. Keep writing!top 10 sexologist doctors in allahabad
ReplyDeletenice post . Thank you for posting something like this,,,,,,
ReplyDeleteMale Infertility prayagraj - Arthayurvedic clinic
Great website, thanks for sharing
ReplyDeleteBuy Components Online at Best Prices|MyBogo|Free Shipping
It is amazing and wonderful to visit your site...gupt rog doctors in allahabad
ReplyDeleteWow this blog is very nice … top 10 sexologist doctors in allahabad
ReplyDeleteYour Blog is very nice.
ReplyDeleteWish to see much more like this. Thanks for sharing your information
Buy Wireless Networking Accessories Online at Best Prices
very nice article thank you
ReplyDeleteBest MNS Coaching Allahabad
This post is really nice thanks for it keep posting. top 10 sexologist doctors in allahabad
ReplyDeleteiMyFone Filme Crack is a super easy-to-use video creation tool to create professional-looking videos. It provides you with plentiful effect .Gilisoft Video Editor Registration Code
ReplyDelete