Skip to content

Latest commit

 

History

History
328 lines (164 loc) · 17.6 KB

clh3jb60300060aky9m9e3th2.md

File metadata and controls

328 lines (164 loc) · 17.6 KB
title datePublished cuid slug cover ogImage tags
Kubernetes Project : Micro-Services on Kubeadm
Sun Apr 30 2023 14:56:17 GMT+0000 (Coordinated Universal Time)
clh3jb60300060aky9m9e3th2
kubernetes-project-micro-services-on-kubeadm
kubernetes, troubleshooting, trainwithshubham, kubeweek, kubeweekchallenge

Introduction🧑‍🦯

Everything till now we have done in our local machine. we have gained knowledge on how to deploy pods and nodes, create master nodes and worker nodes, and create services and secrets using volumes and claims. Now this is the time I was awaiting⏳ (and you too), to do all these things outside the local system.

In this blog, we will be doing a hands-on project🧑‍💻 in which we will Set up and Deploy Microservices on Kubernetes Cluster using kubeadm and Expose them to Postman with Integration of Persistent Volumes and MongoDB and troubleshooting.

We will be using👇

  • python flask micro-services,

  • mongo db for the database,

  • kubeadm for cluster creation, and

  • Postman for accessing the application using persistent volume claims, we will be deploying an instance of mongo db and

a lot of troubleshooting!😵‍💫

Project: A simple task manager application. You can use the project or use our own. Your choice!

Github link: https://github.com/LondheShubham153/microservices-k8s

Setup Kubernetes Cluster using Kubeadm🏗

  1. First, you need an account in AWS to create instances

    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682828077596/e4f1fe1c-b697-4842-a8d8-eb2f32b43cb0.png align="center")

    Now, on the search bar, type instances and select EC2 and then select on Launch Instance button.

    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682828276243/1c95d793-493d-4724-86ff-b428bbd89cec.png align="center")

    Give the name at your convenience.

    • I am giving it kubernetes-master

    • Select the number of instances=2

    • Select the Ubuntu machine

    • Select t2.medium as an Instance type because in the free tier, only 1cpu is available and here we want 2 nodes set up, master and worker.

    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682828531965/ee948ed9-a177-49e4-981e-513526e024d7.png align="center")

    • Now select a key-pair if you have already. If not then create new pair as I have done.

    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682828452351/5d83470d-8083-4e4f-a2c0-9c2852a60dc1.png align="center")

    Now select on launch instance until it's running and passed the checks. And change the name of the 2nd instance as kubernetes-worker

    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682830960660/9e7ff2c8-5581-4cfa-989c-fa0880c180cf.png align="center")

Deploy the Taskmaster Micro-services🥸

Exposes the Service to Postman🧑‍✈️📥

  1. Integrate Persistent Volumes & Persistent Volume Clain

Deploy Mongo DB🛗

Integrate Micro-Services🕵️

Troubleshooting🤕

Today's challenge is all about making a project available and the challenges we faced in doing so and coming over from it.

As we all are doing a 7-day Kubernetes challenge together, we know there are topics for daily to perform. And today we have to perform with AWS, kubeadm, Postman etc.

The problems I have faced doing this project are listed below:👇

  1. AWS Sign-up -

    • This is my first time doing hands-on in aws. So I don't have any account on it.

    • Today early morning I started with doing sign-up. The registration process takes time as it will demand credit/debit card credentials.

    • I submitted the credentials but for no reason, it was unable to take my card credentials. May be bank side issue I don't know. So I waited for a while and tried again after an hour and I signed up.

    • After signing up the Instances section is not showing, it's saying It may take up to 24 hours to start your account.

    • For a moment I thought today I will not make it happen. Then after some time, I tried again and then it worked.

    • So it took me almost 2hours to sign-up for aws.

  2. Correct Directory: When I was generating the keys while creating the instances. The first thing we need to do on entering the terminal is to go inside the directory where the .pem file was downloaded. And I forgot that. And doing sudo ssh in the root directory.

    Then I asked for help from one of the folk then I got my issue resolved. I changed my directory then everything start working.

  3. Network Connectivity - I was doing this whole thing with learning and doing alongside. And suddenly I got this error message:

    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682861211655/66926f0d-7a9c-43e9-8a0b-01781cbe3d16.png align="center")

    And without trying to resolve this, I did the whole procedure from creating instances to installing everything, did all the deployments again then continued further where I left off.

  4. Postman API - I have never worked on Postman so I don't even know the purpose of using it. It took me a lot of time to get started with this service. I watched several youtube videos to understand how it works. Because we need to create GET, PUT and POST method requests for the application to run.

  5. TimoutError - The last error where we stopped, I am still figuring out how to solve that for very long. And I will do that.

Take Aways from My Troubleshooting🎒

  1. If you are doing any challenge like me or preparing for it. Must sign-up early for an AWS account because not for everyone but it might take a day to start your account as it says. So better early than late.🤓

  2. Always follow the steps mentioned already for installation and recheck every step as it can cause you to do the whole process again. And that's very frustrating.😖

  3. A stable internet connection. I know it sounds very childish in a takeaway section, but trust me if you are not in a stable connection it will kill you. And I am dead now.🫠

  4. To do projects like this, you must know each and every aspect of it. You must learn firsts and then apply. It will give you a good understanding and the better results.

  5. Now, talking about the last timeouterror, I am solving the issue and will update this blog soon. Just holding this up for the sake of completing today's challeneg as it is the last day. So if you are reading this in the present tense then let's do it together✊ and comment on your solution, we can discuss it. And if you are reading this in the future then, Nothing. Everything is fine and updated.😄

My learnings from this challenge🧑‍🎓

  • I am learning Kubernetes for a while. But in my learning I was not doing it practically, only learning concepts and moving further without implementing anything🤐. And this challenge changed my way of learning completely. As daily I learned a new topic and implemented it immediately🤯.

  • I have never done this type of challenge before. It trained me how to push myself to learn new things daily♿. And I have never done that. So that's a big achievement for me!🤓

  • I learned architecture before but never get into depth but this time for the sake of writing blogs I deep dive into the architectures of Kubernetes.

  • I learned how to work with AWS and Postman API.

  • I learned how to create an instance and connect it to the local environment and many such things.

A Closing Note!📜

As this is the last of the 7-day series I have mixed feelings. I am relaxed but also quite unhappy because I am a procrastinator and this daily challenge has encouraged me to learn a new topic daily. And this was a big advantage of this challenge.

A message for you!✍️

Don't give up if you lack somewhere behind. If you didn't complete any one of the daily tasks, no worries! It's okk🙂, everyone has their own pace of learning. This 7-day series is not a race🐀 where you have to come first and win the prize.

If you didn't complete today's challenge it doesn't mean you are out of winning. A winner is the one who managed to learn daily in this series. If you have learned something new in these 7 days, you are the winner. Good Job!👏

I am thankful to @Shubham Londhe sir for organizing this amazing 7-day Kubernetes challenge🔥 for the community. This week went amazing with super learnings. Hoping for more such challenges from you🙌.


Thank you all of you for being with me on this 7-day journey🖤.

Happy learnings!🧑‍💻