GithubHelp home page GithubHelp logo

Comments (6)

abohmeed avatar abohmeed commented on August 30, 2024 1

Hello @briankosw
Yes, you're correct. The file is used to auto-join master and worker nodes to the cluster. The reason why it is not included in Terraform is that I am using this repo currently to teach how the student can build a Kubernetes cluster manually using Terraform on AWS. Using the node startup script is an advanced stage that I may include in a future lecture/course.
So, yes, you can fork the repo and use the node startup script. It works with no known issues.

from terraform_kubeadm.

briankosw avatar briankosw commented on August 30, 2024

I see. That's great! Could you help me understand how the script ensures that only one of the master nodes run kubeadm init and the rest run kubeadm join? I've written a script that is similar in concept to yours, but I've been unable to convince myself that I can guarantee that only one master node initializes a cluster.

from terraform_kubeadm.

abohmeed avatar abohmeed commented on August 30, 2024

Simply, loop over all the master nodes over SSH and execute the init command there. If the server replies, exit the loop. Otherwise, continue looping. Once done, loop on the rest of the master/worker nodes and execute the join command.
On AWS, it's easy to get the master and worker nodes by using tags that Kubernetes already requires to be present.

from terraform_kubeadm.

briankosw avatar briankosw commented on August 30, 2024

I see. I guess the only problem that I can see is when more than one master node runs kubeadm init, which will break the cluster according to the official documentation. What about the following change:

  • Designate one master node (e.g. based on the tag as you mentioned above) as the one responsible for initializing the cluster
  • The other master nodes will wait until the cluster is initialized as is done in your script
  • Whenever a master node drops, it can first check that the cluster is up and join using your method in the script

What do you think about that?

from terraform_kubeadm.

abohmeed avatar abohmeed commented on August 30, 2024

I cannot see why more than one master node would run the init command at the same time. As I mentioned, you'll loop on the master nodes and run the command. The first one that reports the command has run successfully causes the loop to exit.
You run the loop sequentially and not in parallel so you try the servers one by one not all at once,

from terraform_kubeadm.

pg3391 avatar pg3391 commented on August 30, 2024

I created 3 tier k8 cluster using your code @abohmeed , Cluster is good, but I'm no way able to login to bastion host using the private even my public key both, can you share if there is any fix ?

from terraform_kubeadm.

Related Issues (1)

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.