#syndic 相当于master的代理,master通过syndic代理控制node主机
master <------ syndic+master <---------- node
master修改
[root@k8s_master ~]# cat /etc/salt/master |grep -v "grep|^$|^#"|grep order_masters order_masters: True [root@k8s_master ~]#
syndic+master
[root@slave3 ~]# yum install salt-syndic [root@slave3 ~]# cat /etc/salt/master |grep -v "grep|^$|^#" syndic_master: 192.168.132.148 #这里指向master的ip [root@slave3 ~]# systemctl restart salt-master [root@slave3 ~]# systemctl start salt-syndic
master查看key
[root@k8s_master ~]# salt-key
Accepted Keys:
k8s_master
k8s_node1
k8s_node2
slave3
Denied Keys:
Unaccepted Keys:
Rejected Keys:
node设置:
[root@slave3 ~]# cat /etc/salt/minion |grep -v "grep|^$|^#" master: 192.168.132.141 #syndic+master 主机ip id: slave3 [root@slave3 ~]# systemctl start salt-minion
syndic+master主机
[root@slave3 ~]# salt-key
Accepted Keys:
slave3
Denied Keys:
Unaccepted Keys:
Rejected Keys:
在syndic+master主机上执行job,然后在master主机上查看结果
#syndic+master主机
[root@slave3 ~]# salt 'slave3' cmd.run ifconfig slave3: ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.132.141 netmask 255.255.255.0 broadcast 192.168.132.255 inet6 fe80::c417:d467:ea7e:9cda prefixlen 64 scopeid 0x20<link> ether 00:0c:29:a7:b3:0f txqueuelen 1000 (Ethernet) RX packets 72554 bytes 42829743 (40.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 68017 bytes 10703886 (10.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 #master主机 [root@k8s_master ~]# salt-run jobs.list_jobs ...... ....... ....... 20180125191843784925: ---------- Arguments: - ifconfig Function: cmd.run StartTime: 2018, Jan 25 19:18:43.784925 Target: slave3 Target-type: glob User: root [root@k8s_master ~]# salt-run jobs.lookup_jid 20180125191843784925 slave3: ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.132.141 netmask 255.255.255.0 broadcast 192.168.132.255 inet6 fe80::c417:d467:ea7e:9cda prefixlen 64 scopeid 0x20<link> ether 00:0c:29:a7:b3:0f txqueuelen 1000 (Ethernet) RX packets 72554 bytes 42829743 (40.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 68017 bytes 10703886 (10.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sls(state)使用说明
master里的top.sls不能直接指定到客户端(minion)的id做管理,但可以直接管理minion(不通过sls),
绿色字体说明:master可以在自己的top.sls里的目标直接写minion的id(此id没有被master接受),只不过执行的top.sls为syndic+master下的top.sls,而master自己的top.sls不会被执行