ReplicationController(老一代的Pod控制器)简称:RC用于确保由其掌控的Pod对象副本数量,能够满足用户期望,多则删除,少则通过模板创建。特点:确保Pod资源的对象的数量精准确保Pod健康运行弹性伸缩同样,他也可以通过yaml或json格式的资源清单来创建。其中spec字段一般嵌套以下字段:replicas:期望的Pod对象副本数量selector:当前控制器匹配Pod对象副
分类:
其他好文 时间:
2020-09-17 18:22:07
阅读次数:
24
kubernetes中资源清单以yaml文件或json格式编写清单列表通过一个清单定义好一个应用后就可以使用kubectl工具来应用他$kubectlcreate-fxxxx.yaml原理:(1)kubectl直接操作APIServer,相当于我们把清单交付给APIServer,然后获取清单描述的应用信息后存入etcd数据库中(2)kube-sheduler组件发现这时候有个pod还没绑定到节点上
分类:
Web程序 时间:
2020-09-17 17:48:49
阅读次数:
33
内置变量ansible_version获取到ansible的版本号ansibletest70-mdebug-a"msg={{ansible_version}}"内置变量hostvars操作当前主机时获取到其他主机中的信息name:"play1:Gatherfactsoftest71"hosts:test71remote_user:rootname:"
分类:
其他好文 时间:
2020-09-17 17:20:47
阅读次数:
79
通过item和with_items对重复操作进行循环执行示例:hosts:jack6_1remote_user:rootgather_facts:notasks:name:touchfilefile:path:"{{item}}"state:touchwith_items:"a""b""c"在jack6_1主机上创建三
分类:
其他好文 时间:
2020-09-17 17:20:16
阅读次数:
39
with_items遍历列表中每个元素,包括嵌套列表with_list将嵌套列表作为整体元素遍历with_together将多个列表中的子列表元素,一起输出,不成对则null补位示例:hosts:jack6_1remote_user:rootgather_facts:notasks:debug:msg:"{{item}}"with_items:[1,2,3][a,b]debug
分类:
其他好文 时间:
2020-09-17 17:19:57
阅读次数:
31
with_indexed_items示例:hosts:jack6_1remote_user:rootgather_facts:notasks:debug:msg:"{{item}}"with_indexed_items:[t1,t2][t3,[t4,t5]][t6]输出结果如下:[root@jack7-1work]#ansible-playbook--syntax-checki
分类:
其他好文 时间:
2020-09-17 17:19:41
阅读次数:
32
with_indexed_items示例:hosts:jack6_1remote_user:rootgather_facts:notasks:debug:msg:"{{item}}"with_indexed_items:[t1,t2][t3,[t4,t5]][t6]输出结果如下:[root@jack7-1work]#ansible-playbook--syntax-checki
分类:
其他好文 时间:
2020-09-17 17:19:20
阅读次数:
33
with_nested采用笛卡尔乘积方式,将多个嵌套列表中的元素交叉组合示例:创建多个目录及子目录mkdir-p/testdir/{a,b,c}/{1,2}ansible剧本如下:hosts:jack6_1remote_user:rootgather_facts:notasks:file:path:"/testdir"state:directoryfile:path:"
分类:
其他好文 时间:
2020-09-17 16:54:16
阅读次数:
24
register注册变量可以将输出信息作为变量值示例:[root@jack7-1work]#catregister.ymlhosts:PCremote_user:roottasks:name:testshellshell:"echotest>/root/test"register:testvar==================>将shell输出的结果赋值给tes
分类:
其他好文 时间:
2020-09-17 16:02:37
阅读次数:
28
格式.yml|.yaml---======>剧本开头-hosts:jack7======>指定主机或主机组remote_user:root====>客户端执行用户tasks:=========>任务标记-name:FIRSTPLAYBOOK===>PLAY名称fetch:=======>调用的模块src:/tmp/test=======>模块的参数及值de
分类:
其他好文 时间:
2020-09-17 12:49:53
阅读次数:
26