kubeadm: Explicitly set token for nodes to join withkubeadm join failing. Unable to request signed certkubeadm says cni config uninitialized for node using weaveJoin cluster after init token expired?Where is Flanneld configuration that Kubernetes (installed by Kubeadm) use?Setting up kubeadm cluster with ubuntu and pi“kubectl get nodes” shows only master not workersProvide node name to kubeadm init using config fileKubeadm join fail. Is my master cluster IP 192.168.0.9 or 10.96.0.1?Node join a master key-value pair missingkubeadm join can't connect

"Valet parking " or "parking valet"

Create two random teams from a list of players

How to calculate points under the curve?

Creating if in setter/getter

Patio gate not at right angle to the house

How can I type the name of the person I'm calling on the dial pad and make the call?

Best Ergonomic Design for a handheld ranged weapon

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

What force enables us to walk? Friction or normal reaction?

What parameters are to be considered when choosing a MOSFET?

Just how much information should you share with a former client?

Word for soundtrack music which is part of the action of the movie

Applications of pure mathematics in operations research

Magento 2 setTemplate and add content to phtml template

May a hotel provide accommodation for fewer people than booked?

Can I shorten this filter, that finds disk sizes over 100G?

How should I save/invest for my son

ULQ2003 not driving a Relay properly

Why Divide does not give the same answer?

Why “deal 6 damage” is a legit phrase?

Prepare a user to perform an action before proceeding to the next step

What would the United Kingdom's "optimal" Brexit deal look like?

Is it possible to tell if a child will turn into a Hag?

If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?



kubeadm: Explicitly set token for nodes to join with


kubeadm join failing. Unable to request signed certkubeadm says cni config uninitialized for node using weaveJoin cluster after init token expired?Where is Flanneld configuration that Kubernetes (installed by Kubeadm) use?Setting up kubeadm cluster with ubuntu and pi“kubectl get nodes” shows only master not workersProvide node name to kubeadm init using config fileKubeadm join fail. Is my master cluster IP 192.168.0.9 or 10.96.0.1?Node join a master key-value pair missingkubeadm join can't connect






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have set up my master nodes using kubeadm.



Now I want to run the join command on my nodes so that the later join the cluster.



All I have to do is run



kubeadm join --token <token> --discovery-token-ca-cert-hash <sha256>


where <token> and are values previously returned by the command below:



kubeadm init 


I am also trying to script the above process and I see that parsing the actual tokens from the last command is kinda difficult;



So I was wandering whether there is a way to explicitly specify the <token> and the <sha256> during cluster initialization, to avoid having to perform hacky parsing of the init command.










share|improve this question
































    1















    I have set up my master nodes using kubeadm.



    Now I want to run the join command on my nodes so that the later join the cluster.



    All I have to do is run



    kubeadm join --token <token> --discovery-token-ca-cert-hash <sha256>


    where <token> and are values previously returned by the command below:



    kubeadm init 


    I am also trying to script the above process and I see that parsing the actual tokens from the last command is kinda difficult;



    So I was wandering whether there is a way to explicitly specify the <token> and the <sha256> during cluster initialization, to avoid having to perform hacky parsing of the init command.










    share|improve this question




























      1












      1








      1








      I have set up my master nodes using kubeadm.



      Now I want to run the join command on my nodes so that the later join the cluster.



      All I have to do is run



      kubeadm join --token <token> --discovery-token-ca-cert-hash <sha256>


      where <token> and are values previously returned by the command below:



      kubeadm init 


      I am also trying to script the above process and I see that parsing the actual tokens from the last command is kinda difficult;



      So I was wandering whether there is a way to explicitly specify the <token> and the <sha256> during cluster initialization, to avoid having to perform hacky parsing of the init command.










      share|improve this question
















      I have set up my master nodes using kubeadm.



      Now I want to run the join command on my nodes so that the later join the cluster.



      All I have to do is run



      kubeadm join --token <token> --discovery-token-ca-cert-hash <sha256>


      where <token> and are values previously returned by the command below:



      kubeadm init 


      I am also trying to script the above process and I see that parsing the actual tokens from the last command is kinda difficult;



      So I was wandering whether there is a way to explicitly specify the <token> and the <sha256> during cluster initialization, to avoid having to perform hacky parsing of the init command.







      kubernetes kubeadm






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 6:58







      pkaramol

















      asked Mar 26 at 22:05









      pkaramolpkaramol

      2,7041 gold badge25 silver badges71 bronze badges




      2,7041 gold badge25 silver badges71 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          1














          I was trying to make a script for it as well.



          In order to get the values needed I am using these commands:



          TOKEN=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP sudo kubeadm token list | tail -1 | cut -f 1 -d " ") 


          HASH=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //' )


          Basically I use this commands to ssh on master and get this values.



          I have not found a easier way to achieve this.






          share|improve this answer
































            0














            Actually there seems to be a way around this:



            (I am putting this in ansible tasks cause this is where I am planning to use it)



             - name: kubernetes.yml --> Initiate kubernetes cluster
            shell: 'kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address= ansible_facts[if_name]["ipv4"]["address"] '
            become: yes
            when: inventory_hostname in groups['masters']


            - name: kubernetes.yml --> Get the join command
            shell: kubeadm token create --print-join-command
            register: rv_join_command
            when: inventory_hostname in (groups['masters'] | last)
            become: yes

            - name: kubernetes.yml --> Print the join command
            debug:
            var: rv_join_command.stdout


            Output:



            TASK [kubernetes.yml --> Print the join command] *******************************
            ok: [kubernetes-master-1] =>
            rv_join_command.stdout: 'kubeadm join 192.168.30.1:6443 --token ah0dbr.grxg9fke3c28dif3i --discovery-token-ca-cert-hash sha256:716712ca7f07bfb4aa7df9a8b30ik3t0k3t2259b8c6fc7b68f50334356078 '





            share|improve this answer



























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366870%2fkubeadm-explicitly-set-token-for-nodes-to-join-with%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I was trying to make a script for it as well.



              In order to get the values needed I am using these commands:



              TOKEN=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP sudo kubeadm token list | tail -1 | cut -f 1 -d " ") 


              HASH=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //' )


              Basically I use this commands to ssh on master and get this values.



              I have not found a easier way to achieve this.






              share|improve this answer





























                1














                I was trying to make a script for it as well.



                In order to get the values needed I am using these commands:



                TOKEN=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP sudo kubeadm token list | tail -1 | cut -f 1 -d " ") 


                HASH=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //' )


                Basically I use this commands to ssh on master and get this values.



                I have not found a easier way to achieve this.






                share|improve this answer



























                  1












                  1








                  1







                  I was trying to make a script for it as well.



                  In order to get the values needed I am using these commands:



                  TOKEN=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP sudo kubeadm token list | tail -1 | cut -f 1 -d " ") 


                  HASH=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //' )


                  Basically I use this commands to ssh on master and get this values.



                  I have not found a easier way to achieve this.






                  share|improve this answer













                  I was trying to make a script for it as well.



                  In order to get the values needed I am using these commands:



                  TOKEN=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP sudo kubeadm token list | tail -1 | cut -f 1 -d " ") 


                  HASH=$(sshpass -p $PASSWORD ssh -o StrictHostKeyChecking=no root@$MASTER_IP openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //' )


                  Basically I use this commands to ssh on master and get this values.



                  I have not found a easier way to achieve this.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 22:15









                  Leandro Donizetti SoaresLeandro Donizetti Soares

                  2061 silver badge7 bronze badges




                  2061 silver badge7 bronze badges


























                      0














                      Actually there seems to be a way around this:



                      (I am putting this in ansible tasks cause this is where I am planning to use it)



                       - name: kubernetes.yml --> Initiate kubernetes cluster
                      shell: 'kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address= ansible_facts[if_name]["ipv4"]["address"] '
                      become: yes
                      when: inventory_hostname in groups['masters']


                      - name: kubernetes.yml --> Get the join command
                      shell: kubeadm token create --print-join-command
                      register: rv_join_command
                      when: inventory_hostname in (groups['masters'] | last)
                      become: yes

                      - name: kubernetes.yml --> Print the join command
                      debug:
                      var: rv_join_command.stdout


                      Output:



                      TASK [kubernetes.yml --> Print the join command] *******************************
                      ok: [kubernetes-master-1] =>
                      rv_join_command.stdout: 'kubeadm join 192.168.30.1:6443 --token ah0dbr.grxg9fke3c28dif3i --discovery-token-ca-cert-hash sha256:716712ca7f07bfb4aa7df9a8b30ik3t0k3t2259b8c6fc7b68f50334356078 '





                      share|improve this answer





























                        0














                        Actually there seems to be a way around this:



                        (I am putting this in ansible tasks cause this is where I am planning to use it)



                         - name: kubernetes.yml --> Initiate kubernetes cluster
                        shell: 'kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address= ansible_facts[if_name]["ipv4"]["address"] '
                        become: yes
                        when: inventory_hostname in groups['masters']


                        - name: kubernetes.yml --> Get the join command
                        shell: kubeadm token create --print-join-command
                        register: rv_join_command
                        when: inventory_hostname in (groups['masters'] | last)
                        become: yes

                        - name: kubernetes.yml --> Print the join command
                        debug:
                        var: rv_join_command.stdout


                        Output:



                        TASK [kubernetes.yml --> Print the join command] *******************************
                        ok: [kubernetes-master-1] =>
                        rv_join_command.stdout: 'kubeadm join 192.168.30.1:6443 --token ah0dbr.grxg9fke3c28dif3i --discovery-token-ca-cert-hash sha256:716712ca7f07bfb4aa7df9a8b30ik3t0k3t2259b8c6fc7b68f50334356078 '





                        share|improve this answer



























                          0












                          0








                          0







                          Actually there seems to be a way around this:



                          (I am putting this in ansible tasks cause this is where I am planning to use it)



                           - name: kubernetes.yml --> Initiate kubernetes cluster
                          shell: 'kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address= ansible_facts[if_name]["ipv4"]["address"] '
                          become: yes
                          when: inventory_hostname in groups['masters']


                          - name: kubernetes.yml --> Get the join command
                          shell: kubeadm token create --print-join-command
                          register: rv_join_command
                          when: inventory_hostname in (groups['masters'] | last)
                          become: yes

                          - name: kubernetes.yml --> Print the join command
                          debug:
                          var: rv_join_command.stdout


                          Output:



                          TASK [kubernetes.yml --> Print the join command] *******************************
                          ok: [kubernetes-master-1] =>
                          rv_join_command.stdout: 'kubeadm join 192.168.30.1:6443 --token ah0dbr.grxg9fke3c28dif3i --discovery-token-ca-cert-hash sha256:716712ca7f07bfb4aa7df9a8b30ik3t0k3t2259b8c6fc7b68f50334356078 '





                          share|improve this answer













                          Actually there seems to be a way around this:



                          (I am putting this in ansible tasks cause this is where I am planning to use it)



                           - name: kubernetes.yml --> Initiate kubernetes cluster
                          shell: 'kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address= ansible_facts[if_name]["ipv4"]["address"] '
                          become: yes
                          when: inventory_hostname in groups['masters']


                          - name: kubernetes.yml --> Get the join command
                          shell: kubeadm token create --print-join-command
                          register: rv_join_command
                          when: inventory_hostname in (groups['masters'] | last)
                          become: yes

                          - name: kubernetes.yml --> Print the join command
                          debug:
                          var: rv_join_command.stdout


                          Output:



                          TASK [kubernetes.yml --> Print the join command] *******************************
                          ok: [kubernetes-master-1] =>
                          rv_join_command.stdout: 'kubeadm join 192.168.30.1:6443 --token ah0dbr.grxg9fke3c28dif3i --discovery-token-ca-cert-hash sha256:716712ca7f07bfb4aa7df9a8b30ik3t0k3t2259b8c6fc7b68f50334356078 '






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 27 at 7:43









                          pkaramolpkaramol

                          2,7041 gold badge25 silver badges71 bronze badges




                          2,7041 gold badge25 silver badges71 bronze badges






























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366870%2fkubeadm-explicitly-set-token-for-nodes-to-join-with%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현