单机环境,本机虚拟机:centos7.4
配置文件如下:
env.user = 'root'
env.password = '123'
#env.key_filename = "~/.ssh/id_rsa"
env.port = 22
env.abort_on_prompts = True
env.colors = True
env.use_lvs = False
env.roledefs = {
# 发布机,后面通过在此机器上执行kubectl命令控制k8s集群及部署应用
'publish': {
'hosts': [
'192.168.1.138',
],
},
# etcd节点安装主机(支持集群)
'etcd': {
'hosts': [
'192.168.1.138',
],
# 负载均衡etcd入口ip(虚ip)
'vip': 'etcd'
},
# master节点安装主机(支持集群)
'master': {
'hosts': [
'192.168.1.138',
],
# 负载均衡master入口ip(虚ip)
'vip': 'master'
},
# node节点安装主机(支持集群)
'node': {
'hosts': [
'192.168.1.138',
]
2.安装过程出错地方:
{2019年 06月 22日 星期六 23:49:15 CST}[结束]安装dns.............................
{2019年 06月 22日 星期六 23:49:15 CST}[开始]启动所有服务.............................
[192.168.1.138] Executing task 'service_publish'
[192.168.1.138] run: systemctl start docker
Done.
[192.168.1.138] Executing task 'service_etcd'
[192.168.1.138] run: systemctl start etcd
[192.168.1.138] run: iptables -P FORWARD ACCEPT ; echo "" > /dev/null
Done.
[192.168.1.138] Executing task 'service_etcd'
[192.168.1.138] run: systemctl restart etcd
[192.168.1.138] run: iptables -P FORWARD ACCEPT ; echo "" > /dev/null
Done.
[192.168.1.138] Executing task 'service_master'
[192.168.1.138] run: systemctl start kube-apiserver
[192.168.1.138] out: Job for kube-apiserver.service failed because the control process exited with error code. See "systemctl status kube-apiserver.service" and "journalctl -xe" for details.
[192.168.1.138] out:
Fatal error: run() received nonzero return code 1 while executing!
Requested: systemctl start kube-apiserver
Executed: /bin/bash -l -c "systemctl start kube-apiserver"
Aborting.
Fatal error: One or more hosts failed while executing task 'service_master'
Aborting.
[root@localhost install_k8s]# systemctl status kube-apiserver.service" and "journalctl -xe
systemctl:无效选项 -- x'
查看api服务状态:
[root@localhost install_k8s]# systemctl status kube-apiserver.service
● kube-apiserver.service - Kubernetes API Server
Loaded: loaded (/usr/lib/systemd/system/kube-apiserver.service; enabled; vendor preset: disabled)
Active: activating (start) since 六 2019-06-22 23:50:18 CST; 10s ago
Docs: https://github.com/kubernetes
Main PID: 4279 (kube-apiserver)
Memory: 15.1M
CGroup: /system.slice/kube-apiserver.service
└─4279 /usr/bin/kube-apiserver --logtostderr=true --v=0 --etcd-servers=https://etcd:2379 --bind-address=0.0.0.0 --allow-privileged=true --service-cluster-ip-range=192.168.0.0/16 --enable-admissio...
6月 22 23:50:18 localhost.localdomain systemd[1]: kube-apiserver.service holdoff time over, scheduling restart.
6月 22 23:50:18 localhost.localdomain systemd[1]: Starting Kubernetes API Server...
6月 22 23:50:18 localhost.localdomain kube-apiserver[4279]: I0622 23:50:18.926130 4279 server.go:557] external host was not specified, using 192.168.1.138
6月 22 23:50:18 localhost.localdomain kube-apiserver[4279]: I0622 23:50:18.926900 4279 server.go:146] Version: v1.13.3-1+e85e6a94bac0e4
6月 22 23:50:21 localhost.localdomain kube-apiserver[4279]: W0622 23:50:21.465086 4279 admission.go:76] PersistentVolumeLabel admission controller is deprecated. Please remove this controlle...and scripts.
6月 22 23:50:21 localhost.localdomain kube-apiserver[4279]: I0622 23:50:21.465572 4279 plugins.go:158] Loaded 9 mutating admission controller(s) successfully in the following order: Namespac...sionWebhook.
6月 22 23:50:21 localhost.localdomain kube-apiserver[4279]: I0622 23:50:21.465590 4279 plugins.go:161] Loaded 7 validating admission controller(s) successfully in the following order: Namesp...sourceQuota.
6月 22 23:50:21 localhost.localdomain kube-apiserver[4279]: W0622 23:50:21.466731 4279 admission.go:76] PersistentVolumeLabel admission controller is deprecated. Please remove this controlle...and scripts.
6月 22 23:50:21 localhost.localdomain kube-apiserver[4279]: I0622 23:50:21.467379 4279 plugins.go:158] Loaded 9 mutating admission controller(s) successfully in the following order: Namespac...sionWebhook.
6月 22 23:50:21 localhost.localdomain kube-apiserver[4279]: I0622 23:50:21.467393 4279 plugins.go:161] Loaded 7 validating admission controller(s) successfully in the following order: Namesp...sourceQuota.
Hint: Some lines were ellipsized, use -l to show in full.