# kubernetes-ansible **Repository Path**: pippozq/kubernetes-ansible ## Basic Information - **Project Name**: kubernetes-ansible - **Description**: 利用ansible自动化安装k8s集群 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 4 - **Created**: 2017-05-31 - **Last Updated**: 2021-11-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Kubernetes-ansible 1. Install etcd,flannel,kubernetes by Ansible 2. Using Redhad epel yum source 3. kubernetes Version is not the lastest (latest version is **1.9**, version in epel is just **1.5**) ## Install Etcd 1. Update the etcd host in hosts/hosts file (for now, do not support cluster) ``` [etcd] 172.16.251.60 # this is the etcd host ``` 2. Update the "etcd_prefix" in vars/etcd.yml ``` --- #etcd args etcd_config_path: '/etc/etcd/' etcd_prefix: '/k8s/network' # prefix which flannel will use ``` ``` # By default, using the ssh public key, so you can use ansible-playbook -i hosts/hosts etcd.yml # Using password ansible-playbook -i hosts/hosts etcd.yml --ask-pass ``` ## Install kubernetes Master 1. Update the kube_master host in hosts/hosts file (for now, do not support cluster) ``` [kube_master] 172.16.251.60 # your master host ``` 2. Update the vars/redhat_kube_master.yml ``` --- kubernetes_master_install_list: - "epel-release" - "kubernetes" - "flannel" kubernetes_config_file_list: - 'apiserver' - 'config' - 'kubelet' - 'proxy' #common args sys_config_path: '/etc/sysconfig' #kube args kube_config_path: '/etc/kubernetes' kube_master: '172.16.251.60:8080' # your master ip or domain #kube service kubernetes_services: - "kube-apiserver" - "kube-controller-manager" - "kube-proxy" - "kube-scheduler" - 'kubelet' - 'kube-proxy' #docker registry docker_registry: '172.16.251.35:5000' # your private docker registry #flannel args etcd_endpoint: 172.16.251.60:2379 # etcd endpoint etcd_prefix: '/k8s/network' # must be same as vars/etcd.yml eth: 'eth0' # your eth name ``` ``` # By default, using the ssh public key, so you can use ansible-playbook -i hosts/hosts kube_master.yml # Using password ansible-playbook -i hosts/hosts kube_master.yml --ask-pass ``` ## Install kubernetes Node 1. Update the kube_node host in hosts/hosts file ``` [kube_node] 172.16.251.61 172.16.251.62 ``` 2. Update the vars/redhat_kube_node.yml ``` --- kubernetes_node_install_list: - "epel-release" - "kubernetes-node" - "flannel" kubernetes_config_file_list: - 'config' - 'kubelet' - 'proxy' #common args sys_config_path: '/etc/sysconfig' #kube args kube_config_path: '/etc/kubernetes' kube_master: '172.16.251.60:8080' # your master ip or domain #docker registry docker_registry: '172.16.251.35:5000' # your private docker registry #flannel args etcd_endpoint: 172.16.251.60:2379 # etcd endpoint etcd_prefix: '/k8s/network' # must be same as vars/etcd.yml eth: 'eth0' # your eth name ``` ``` # By default, using the ssh public key, so you can use ansible-playbook -i hosts/hosts kube_node.yml # Using password ansible-playbook -i hosts/hosts kube_node.yml --ask-pass ``` ## License source code is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).