-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更新 k8s version 到 1.22.2,适配 centos8, 不兼容 centos7, 增加 keepalived+haprox…
…y 高可用配置
- Loading branch information
root
committed
Oct 13, 2021
1 parent
34756d2
commit a0b6dcc
Showing
30 changed files
with
562 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
# ansible-k8s | ||
|
||
ansible-k8s version|os|k8s version | ||
-----|-----|----- | ||
v0.2.0|CentOS 8|1.22.2 | ||
v0.1.0|CentOS 7|1.21.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
[k8sCluster:children] | ||
masters | ||
nodes | ||
install | ||
new_nodes | ||
|
||
# Set variables common for all k8s-cluster hosts | ||
[k8sCluster:vars] | ||
# SSH user, this user should allow ssh based auth without requiring a password | ||
ansible_ssh_user=root | ||
ansible_port=22 | ||
|
||
# If ansible_ssh_user is not root, ansible_become must be set to true | ||
ansible_become=false | ||
|
||
# 是否更新操作系统及内核 | ||
is_system_update=True | ||
|
||
# 默认节点不是公网节点 | ||
public_network_node = True | ||
|
||
# 是否开启 flannel | ||
flannel_enable=True | ||
|
||
# api server 域名 | ||
master_vip="172.26.181.239" | ||
master_vip_advertise_address="x.x.x.x" | ||
node_domain=solarfs.k8s | ||
install_domain=install.{{node_domain}} | ||
api_server_domain="api-server.{{node_domain}}" | ||
api_server_port="6443" | ||
|
||
# k8s 版本 | ||
k8s_version=1.21.4 | ||
# 定义外部镜像仓库 | ||
registry_domain=docker.io | ||
registry_repo="{{registry_domain}}" | ||
kubeadm_registry_repo="registry.cn-hangzhou.aliyuncs.com" | ||
coredns_image_repo="{{registry_repo}}/coredns" | ||
coredns_image_tag="1.8.4" | ||
flannel_image_repo="quay.io" | ||
flannel_image_tag="v0.14.0" | ||
|
||
# subnet | ||
service_subnet=10.96.0.0/12 | ||
pod_subnet=10.128.0.0/16 | ||
|
||
# helm | ||
helm_binary_md5=e4500993ba21e5e6bdfbc084b4342025 | ||
helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.0-linux-amd64.tar.gz | ||
|
||
[install] | ||
master1.solarfs.k8s | ||
|
||
[masters] | ||
master1.solarfs.k8s ansible_host=172.26.181.236 advertise_address="x.x.x.x" | ||
master2.solarfs.k8s ansible_host=172.26.181.237 advertise_address="x.x.x.x" | ||
master3.solarfs.k8s ansible_host=172.26.181.238 advertise_address="x.x.x.x" | ||
|
||
[nodes] | ||
node1.solarfs.k8s ansible_host=172.26.181.240 advertise_address="x.x.x.x" | ||
node2.solarfs.k8s ansible_host=x.x.x.x advertise_address="x.x.x.x" | ||
|
||
[new_nodes] | ||
node3.solarfs.k8s ansible_host=x.x.x.x advertise_address="x.x.x.x" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
[k8sCluster:children] | ||
masters | ||
nodes | ||
install | ||
new_nodes | ||
|
||
# Set variables common for all k8s-cluster hosts | ||
[k8sCluster:vars] | ||
# SSH user, this user should allow ssh based auth without requiring a password | ||
ansible_ssh_user=root | ||
#ansible_ssh_pass=123456 | ||
ansible_port=22 | ||
|
||
# If ansible_ssh_user is not root, ansible_become must be set to true | ||
ansible_become=false | ||
|
||
# 是否更新操作系统及内核 | ||
is_system_update=True | ||
|
||
# 默认节点不是公网节点 | ||
public_network_node = False | ||
|
||
# 是否开启 flannel | ||
flannel_enable=True | ||
|
||
# k8s 版本 | ||
k8s_version=1.22.2 | ||
# 定义外部镜像仓库 | ||
registry_domain=docker.io | ||
registry_repo="{{registry_domain}}" | ||
kubeadm_registry_repo="registry.cn-hangzhou.aliyuncs.com" | ||
coredns_image_repo="{{registry_repo}}/coredns" | ||
coredns_image_tag="1.8.6" | ||
flannel_image_repo="quay.io" | ||
flannel_image_tag="v0.14.0" | ||
|
||
# subnet | ||
service_subnet=10.96.0.0/12 | ||
pod_subnet=10.128.0.0/16 | ||
|
||
# api server | ||
master_vip="172.16.92.250" | ||
master_vip_advertise_address="172.16.92.250" | ||
node_domain=solarfs.k8s | ||
install_domain=install.{{node_domain}} | ||
api_server_domain="api-server.{{node_domain}}" | ||
api_server_src_port="6443" | ||
api_server_port="8443" | ||
haproxy_image="{{registry_repo}}/library/haproxy:2.1.4" | ||
# keepalived | ||
keepalived_haproxy_enabled=True | ||
keepalived_image="{{registry_repo}}/osixia/keepalived:2.0.17" | ||
# keepalived router id , 不同集群 id 不同 | ||
keepalived_router_id=250 | ||
keepalived_auth_pass=solarfs{{keepalived_router_id}} | ||
|
||
# helm | ||
helm_binary_md5=e4500993ba21e5e6bdfbc084b4342025 | ||
helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.0-linux-amd64.tar.gz | ||
|
||
[install] | ||
master1.solarfs.k8s | ||
|
||
[masters] | ||
master1.solarfs.k8s ansible_host=172.16.188.11 | ||
master2.solarfs.k8s ansible_host=172.16.94.181 | ||
master3.solarfs.k8s ansible_host=172.16.241.26 | ||
|
||
[nodes] | ||
logging1.solarfs.k8s ansible_host=172.16.13.77 | ||
logging2.solarfs.k8s ansible_host=172.16.36.25 | ||
logging3.solarfs.k8s ansible_host=172.16.115.194 | ||
|
||
[new_nodes] | ||
#node3.solarfs.k8s ansible_host=x.x.x.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/python2 | ||
# _*_ coding:utf-8 _*_ | ||
__author__ = 'yhchen' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
language: python | ||
python: "2.7" | ||
|
||
# Use the new container infrastructure | ||
sudo: false | ||
|
||
# Install ansible | ||
addons: | ||
apt: | ||
packages: | ||
- python-pip | ||
|
||
install: | ||
# Install ansible | ||
- pip install ansible | ||
|
||
# Check ansible version | ||
- ansible --version | ||
|
||
# Create ansible.cfg with correct roles_path | ||
- printf '[defaults]\nroles_path=../' >ansible.cfg | ||
|
||
script: | ||
# Basic role syntax check | ||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Role Name | ||
========= | ||
|
||
A brief description of the role goes here. | ||
|
||
Requirements | ||
------------ | ||
|
||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. | ||
|
||
Dependencies | ||
------------ | ||
|
||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: | ||
|
||
- hosts: servers | ||
roles: | ||
- { role: username.rolename, x: 42 } | ||
|
||
License | ||
------- | ||
|
||
BSD | ||
|
||
Author Information | ||
------------------ | ||
|
||
An optional section for the role authors to include contact information, or a website (HTML is not allowed). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# defaults file for ha-loadbalance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for ha-loadbalance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
galaxy_info: | ||
author: your name | ||
description: your role description | ||
company: your company (optional) | ||
|
||
# If the issue tracker for your role is not on github, uncomment the | ||
# next line and provide a value | ||
# issue_tracker_url: http://example.com/issue/tracker | ||
|
||
# Choose a valid license ID from https://spdx.org - some suggested licenses: | ||
# - BSD-3-Clause (default) | ||
# - MIT | ||
# - GPL-2.0-or-later | ||
# - GPL-3.0-only | ||
# - Apache-2.0 | ||
# - CC-BY-4.0 | ||
license: license (GPL-2.0-or-later, MIT, etc) | ||
|
||
min_ansible_version: 2.9 | ||
|
||
# If this a Container Enabled role, provide the minimum Ansible Container version. | ||
# min_ansible_container_version: | ||
|
||
# | ||
# Provide a list of supported platforms, and for each platform a list of versions. | ||
# If you don't wish to enumerate all versions for a particular platform, use 'all'. | ||
# To view available platforms and versions (or releases), visit: | ||
# https://galaxy.ansible.com/api/v1/platforms/ | ||
# | ||
# platforms: | ||
# - name: Fedora | ||
# versions: | ||
# - all | ||
# - 25 | ||
# - name: SomePlatform | ||
# versions: | ||
# - all | ||
# - 1.0 | ||
# - 7 | ||
# - 99.99 | ||
|
||
galaxy_tags: [] | ||
# List tags for your role here, one per line. A tag is a keyword that describes | ||
# and categorizes the role. Users find roles by searching for tags. Be sure to | ||
# remove the '[]' above, if you add tags to this list. | ||
# | ||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters. | ||
# Maximum 20 tags per role. | ||
|
||
dependencies: [] | ||
# List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
# if you add dependencies to this list. | ||
|
Oops, something went wrong.