Skip to content

minions don't re-authenticate in a multi-master setup #17032

Closed

Description

@bernieke

In a single-master setup the minions will try to re-authenticate with the master until they succeed.

But in a multi-master setup we observe the following behavior when starting a minion process:

  • if no masters are up, the minion fails to start
  • if not all masters are up, the minion only authenticates with the masters which are up (if for instance you reboot an appliance which hosts both a salt-master and a salt-minion (in multi-master configuration), after reboot you'll notice the master on that appliance can't address its minion unless you wait a few seconds and restart the minion...)

I would expect the minions to behave the same in both situations. (They should try to re-authenticate with all configured masters.)

We use salt as follows:

  • we have multiple loadbalanced frontend appliances, which each run a salt-master
  • the frontend applications use the salt-master to execute states on the minions

Just to place this in context:
As the behavior currently stands we need to do the following to make sure everything works ok:

  • we first test.ping all minions
  • if some don't report back, we "normal ping" them
  • if they are online, we try to "regular ssh" restart the minions on them
    (if they aren't, we fail the command, refusing to execute states as long as not all our minions are up)
  • we then wait a bit, and retry the test.ping
  • once all are reported up (well, authenticated really...), we can execute our states

We would expect only to need to do the first test.ping to make sure they are all up, and then either execute the states, or raise an error if not all were up.

Activity

  1. cachedout commented on Oct 30, 2014

    @cachedout
    Contributor

    Hi @bernieke

    Against which version of Salt are you observing the behaviour wherein if a minion is configured for MM, it will not start up if no masters can be reached? I have tested this against 2014.7rc6 this morning and I do not see that happening. Instead, I see a minion that's configured for multiple masters start up and wait until those masters come online and connecting to them when they do.

    This MM code has had a fair amount of work done on it for 2014.7 so if you haven't tested your setup against one of the RCs, you may find that some (if not all) of your concerns have already been addressed.

  2. added
    bug
    pending-discussion
    on Oct 30, 2014
  3. added this to the Approved milestone on Oct 30, 2014
  4. bernieke commented on Oct 30, 2014

    @bernieke
    ContributorAuthor

    I'm also on 2014.7.0rc6

    I've just checked again, since the last time I tried this I wasn't on rc6 yet, but the behavior I described is still there.

    What I'm doing (on both appliances simultaneously):

    stop salt-minion
    stop salt-master
    start salt-minion
    sleep 15
    ps aux|grep salt-minion
    

    The ps will show salt-minion having died.

    This is the minion log:

    2014-10-30 16:28:58,533 [salt             ][INFO    ] Setting up the Salt Minion "node2"
    2014-10-30 16:28:58,534 [salt.utils.process][DEBUG   ] Created pidfile: /var/run/salt-minion.pid
    2014-10-30 16:28:58,535 [salt.minion      ][DEBUG   ] MultiMinion PUB socket URI: ipc:///var/run/salt/minion/minion_event_78882aaeb0_pub.ipc
    2014-10-30 16:28:58,535 [salt.minion      ][DEBUG   ] MultiMinion PULL socket URI: ipc:///var/run/salt/minion/minion_event_78882aaeb0_pull.ipc
    2014-10-30 16:28:58,535 [salt.minion      ][INFO    ] Starting pub socket on ipc:///var/run/salt/minion/minion_event_78882aaeb0_pub.ipc
    2014-10-30 16:28:58,535 [salt.minion      ][INFO    ] Starting pull socket on ipc:///var/run/salt/minion/minion_event_78882aaeb0_pull.ipc
    2014-10-30 16:28:58,536 [salt.config      ][DEBUG   ] Reading configuration from /etc/salt/minion
    2014-10-30 16:28:58,756 [salt.minion      ][DEBUG   ] Attempting to authenticate with the Salt Master at 10.147.128.120
    2014-10-30 16:28:58,758 [salt.crypt       ][DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
    2014-10-30 16:29:03,811 [salt.minion      ][ERROR   ] Error while bringing up minion for multi-master. Is master at 10.147.128.120 responding?
    2014-10-30 16:29:03,812 [salt.config      ][DEBUG   ] Reading configuration from /etc/salt/minion
    2014-10-30 16:29:04,051 [salt.minion      ][DEBUG   ] Attempting to authenticate with the Salt Master at 10.147.128.112
    2014-10-30 16:29:04,052 [salt.crypt       ][DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
    2014-10-30 16:29:09,109 [salt.minion      ][ERROR   ] Error while bringing up minion for multi-master. Is master at 10.147.128.112 responding?
    2014-10-30 16:29:09,110 [salt.minion      ][ERROR   ] Error while bringing up minion for multi-master. All configured masters [10.147.128.120, 10.147.128.112] are not responding!!!
    2014-10-30 16:29:09,112 [salt             ][ERROR   ] Error while bringing up minion for multi-master. All configured masters [10.147.128.120, 10.147.128.112] are not responding!!!
    

    My master config:

    log_level: debug
    

    And minion config:

    master:
      - 10.147.128.112
      - 10.147.128.120
    
    log_level: debug
    

    I'm on ubuntu 14.04

  5. bernieke commented on Oct 30, 2014

    @bernieke
    ContributorAuthor

    Note that I've updated the comment above with the correct test script.

  6. rallytime commented on Oct 30, 2014

    @rallytime
    Contributor

    @bernieke - I am able to reproduce this error. We'll get this fixed up!

  7. added
    severity-low
    Packaging
    Confirmed
    and removed
    pending-discussion
    Packaging
    on Oct 30, 2014
  8. cachedout commented on Oct 30, 2014

    @cachedout
    Contributor

    The problem was that I wasn't waiting long enough to see the timeout. You
    are correct. We'll fix this. Thanks!

    On Thu, Oct 30, 2014 at 2:00 PM, Nicole Thomas [email protected]
    wrote:

    @bernieke https://github.com/bernieke - I am able to reproduce this
    error. We'll get this fixed up!

    —
    Reply to this email directly or view it on GitHub
    #17032 (comment).

  9. foxx commented on Nov 4, 2014

    @foxx

    Also getting this same problem;

    root@db1:~# salt-minion  --version
    salt-minion 2014.1.13 (Hydrogen)
    
  10. 10 remaining items

  11. added
    P2
    and removed
    severity-medium
    on Apr 8, 2015
  12. vakulich commented on Apr 13, 2015

    @vakulich
    Contributor

    Hello!

    I was able to reproduce this issue with the latest HEAD from the 2014.7 branch.

    If minion is configured with 2 saltmasters:

    • stop masters and minion
    • start master 1 only
    • start minion
    • start master 2
    • try to do test.ping from both masters: it will work from master 1 but not work from master 2 until you restart minion again so it will be able to re-auth with master 2.
  13. bernieke commented on Apr 24, 2015

    @bernieke
    ContributorAuthor

    I've just tried this on 2014.7.5, and the problem still exists.

    Both the behavior where minions fail to start when no masters are running, and the behavior where minions won't listen to a master which isn't up when the minion was first started.

  14. removed
    fixed-pls-verify
    on Apr 24, 2015
  15. rallytime commented on Apr 24, 2015

    @rallytime
    Contributor

    Thanks for the updates. I am seeing the same thing. If all masters are up and running when the minion starts, and then later one of the masters goes down, I am seeing the minions reconnect. But you're right, if the master isn't up when the minion first starts and tries to connect, the behavior is still the same/broken.

  16. charleshbaker commented on May 12, 2015

    @charleshbaker

    Having this issue on 2014.7.1. Tried restarting the masters and restarting the minion. Same error. Any recommended workarounds?

    [root@ip-xx-yy-zz-aa salt]# salt-minion -l debug
    [DEBUG   ] Reading configuration from /etc/salt/minion
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/masters.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/masters.conf
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/startup.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/startup.conf
    [DEBUG   ] Using cached minion ID from /etc/salt/minion_id: i-wwxxyyzz
    [DEBUG   ] Configuration file path: /etc/salt/minion
    [INFO    ] Setting up the Salt Minion "i-wwxxyyzz"
    [DEBUG   ] Created pidfile: /var/run/salt-minion.pid
    [DEBUG   ] MultiMinion PUB socket URI: ipc:///var/run/salt/minion/minion_event_6ce01a1300_pub.ipc
    [DEBUG   ] MultiMinion PULL socket URI: ipc:///var/run/salt/minion/minion_event_6ce01a1300_pull.ipc
    [INFO    ] Starting pub socket on ipc:///var/run/salt/minion/minion_event_6ce01a1300_pub.ipc
    [INFO    ] Starting pull socket on ipc:///var/run/salt/minion/minion_event_6ce01a1300_pull.ipc
    [DEBUG   ] Reading configuration from /etc/salt/minion
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/masters.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/masters.conf
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/startup.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/startup.conf
    [DEBUG   ] Attempting to authenticate with the Salt Master at xx.yy.zz.aa
    [DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
    [ERROR   ] Error while bringing up minion for multi-master. Is master at xx.yy.zz.aa responding?
    [DEBUG   ] Reading configuration from /etc/salt/minion
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/masters.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/masters.conf
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/startup.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/startup.conf
    [DEBUG   ] Attempting to authenticate with the Salt Master at yy.zz.aa.bb
    [DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
    [ERROR   ] Error while bringing up minion for multi-master. Is master at yy.zz.aa.bb responding?
    [ERROR   ] Error while bringing up minion for multi-master. All configured masters [xx.yy.zz.aa, yy.zz.aa.bb] are not responding!!!
    [ERROR   ] Error while bringing up minion for multi-master. All configured masters [xx.yy.zz.aa, yy.zz.aa.bb] are not responding!!!

  17. DaveQB commented on May 15, 2015

    @DaveQB
    Contributor

    Just adding our update on this.
    We've just upgraded to 2014.7.5 and found about 50% of our minions "disappeared" much like the result of upgrading to 2014.7.1

    I've created an ssh script to loop through all the minion machines and restart salt (glad AWS allows easy look up of all servers IP addresses).

  18. rallytime commented on May 21, 2015

    @rallytime
    Contributor

    I have just tested this on a soon-to-be released/potential 2015.5.1. It would appear that most of the original bugs/concerns are fixed. However, some of the things that are fixed are traded for another problem in a new bug, #21744. I wanted to take a moment to explain the differences in behavior that I am seeing from the 2014.7 releases to the 2015.5 releases in my testing.

    Basically what I am seeing (on 2015.5.1) is this:

    Expected (and Good) Behavior:

    • Start both masters, start minions, command execution/returns/etc happen as expected.
    • If a master goes down, the other master(s) can communicate with the minions just fine.
    • Masters can come back up and continue communicating with the minions just fine as well.
    • Even if all masters go down (but the minions stay up), the masters can still communicate with the minions when the master(s) come back online.

    Improvements in Minion Re-Authenticating with Master:

    • Before 2015.5.0, if you started the minion and one or more masters were down, the minion would never authenticate with the masters that were down without restarting the minion.
    • Now, if the minion starts and one or more masters is down, the minion will continue to try to authenticate with the down master(s) until all masters are up. For example, if the minion starts and no masters are up, the minion will continue to try to connect with each master. I believe this resolves the original issue(s) here, but unfortunately we are trading that behavior for the problem listed in [2015.5] Multi-Master Minions Block on Authentication #21744.

    Caveat/Problems because of #21744:

    • Because the minion blocks on authenticating with all masters on minion start, this means if one master is down, you cannot command the minion from any master.
    • This behavior is very far from ideal and we definitely need to get it fixed. It should be noted that once the necessary master processes have been started again and the minion can now initially authenticate, masters can go down and come back up as needed as described above.
    • I realize that this behavior is still very similar to the original report. (Masters need to be up when the minion starts.) The difference here is that the master process can be started instead of finding lost minions and starting the minion process.
  19. added
    Core
    and removed
    Core
    on May 26, 2015
  20. bernieke commented on Jun 12, 2015

    @bernieke
    ContributorAuthor

    I've noticed that adding "auth_safemode: true" to the minion config gets 2014.7.0 the same behavior as 2015 currently has per ticket #21744

    As described in that ticket I've gone and hacked up a fix for us (on top of 2014.7.0), which combined with auth_safemode gives us the behavior we need. (Masters and minions can now start/restart with any of them running/stopped, and everything just works the way you would expect.)

    I've set auth_timeout and random_reauth_delay to 15 seconds, and auth_tries to 1. This, combined with a 120 second timeout in the master config, makes it so any call executed will actually come through on any running minion, even if it needs to reauthenticate. (I've tried using ping_interval to avoid this problem, but that didn't do anything for me. Possibly another multimaster bug?)

  21. bernieke commented on Aug 11, 2015

    @bernieke
    ContributorAuthor

    Seems these problems are all fixed in 2015.8, thanks to the rewrite using tornado.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ConfirmedCoreMulti-MasterP2bugseverity-high

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions