#Configuring kubernetes on Fedora via Ansible.
Configuring kubernetes on Fedora via Ansible offers a simple way to quickly create a clustered environment with little effort.
Requirements:
The hosts can be virtual or bare metal. It's your choice. Ansible will take care of the rest of the configuration for you - configuring networking, installing packages, handling the firewall, etc... This example will use one master and two minions.
System Information:
Hosts:
fed1 (master) = 192.168.121.205
fed2 (minion) = 192.168.121.84
fed2 (minion)= 192.168.121.116
Versions:
Fedora release 20 (Heisenbug)
etcd-0.4.6-3.fc20.x86_64
kubernetes-0.2-0.4.gitcc7999c.fc20.x86_64
Now, let's get started with the configuration.
rpm -ql ansible | grep bin
cat /etc/fedora-release
git clone https://github.com/eparis/kubernetes-ansible.git
cd kubernetes-ansible
[masters]
192.168.121.205
[etcd]
192.168.121.205
[minions]
192.168.121.84 kube_ip_addr=10.0.1.1
192.168.121.116 kube_ip_addr=10.0.2.1
tree roles/
cat keys.yml
cat setup.yml
echo "password" > ~/rootpassword
Set root password on all atomic hosts to match the password in the rootpassword file. Ansible will use the ansible_ssh_pass method to parse the file and gain access all the hosts.
Ping the hosts.
ansible-playbook -i inventory ping.yml # This will look like it fails, that's ok
ansible-playbook -i inventory keys.yml
ansible-playbook -i inventory setup.yml
That's all there is to it. It's really that easy. At this point you should have a functioning kubernetes cluster.
systemctl | grep -i kube
iptables -nvL
cat ~/apache.json
{
"id": "fedoraapache",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "fedoraapache",
"containers": [{
"name": "fedoraapache",
"image": "fedora/apache",
"ports": [{
"containerPort": 80,
"hostPort": 80
}]
}]
}
},
"labels": {
"name": "fedoraapache"
}
}
/bin/kubecfg -c apache.json create pods
docker ps
docker images
curl http://localhost
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。