-
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.
Merge pull request #1 from paradeum-team/jyliu
feat: 更新直接从外部拉取 k8s 镜像镜像, 优化部署参数,添加文档
- Loading branch information
Showing
9 changed files
with
242 additions
and
22 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
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,61 @@ | ||
[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.117.104" | ||
master_vip_advertise_address="8.142.71.35" | ||
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=registry.hisun.netwarps.com | ||
registry_repo="{{registry_domain}}" | ||
kubeadm_registry_repo="registry.cn-hangzhou.aliyuncs.com" | ||
coredns_image_repo="docker.io/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=24b16800f8c7f44b5dd128e3355ecf1b | ||
helm_binary_url=https://pnode.solarfs.io/dn/file/{{helm_binary_md5}}/helm-v3.6.3-linux-amd64.tar.gz | ||
|
||
[install] | ||
master1.solarfs.k8s | ||
|
||
[masters] | ||
master1.solarfs.k8s ansible_host=172.26.117.104 advertise_address="8.142.71.35" | ||
|
||
[nodes] | ||
node1.solarfs.k8s ansible_host=8.142.71.142 advertise_address="8.142.71.142" | ||
|
||
[new_nodes] |
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,161 @@ | ||
# 使用公有云跨机房公网搭建k8s 1.21.4 | ||
|
||
## 下载 ansible-k8s | ||
|
||
``` | ||
yum install -y git ansible | ||
mkdir -p /data | ||
cd /data | ||
git clone https://github.com/paradeum-team/ansible-k8s.git | ||
``` | ||
|
||
## 修改 ansible 配置 | ||
|
||
``` | ||
cd /data/ansible-k8s/ | ||
cp ansible.hosts.tpl ansible.hosts.tmp | ||
``` | ||
|
||
修改 `ansible.hosts.tmp` 如下 | ||
|
||
``` | ||
[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.117.104" | ||
master_vip_advertise_address="8.142.71.35" | ||
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=registry.hisun.netwarps.com | ||
registry_repo="{{registry_domain}}" | ||
kubeadm_registry_repo="registry.cn-hangzhou.aliyuncs.com" | ||
coredns_image_repo="docker.io/coredns" | ||
coredns_image_tag="1.8.4" | ||
# 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 | ||
helm_repo_install=False | ||
#helm_repo_name=chartmuseum-hisun | ||
#helm_repo=https://charts.apps181227.hisun.k8s | ||
#helm_username=admin | ||
#helm_password=12345678 | ||
[install] | ||
master1.solarfs.k8s | ||
[masters] | ||
master1.solarfs.k8s ansible_host=172.26.117.104 advertise_address="8.142.71.35" | ||
[nodes] | ||
node1.solarfs.k8s ansible_host=8.142.71.142 advertise_address="8.142.71.142" | ||
[new_nodes] | ||
``` | ||
|
||
## 配置master1免密登录自己和其它主机 | ||
|
||
略 | ||
|
||
## 安装 k8s | ||
|
||
所有主机初始化 | ||
|
||
``` | ||
./base_init.sh | ||
``` | ||
|
||
安装 k8s | ||
|
||
``` | ||
./install_k8s.sh | ||
``` | ||
|
||
## 安装 ingress-nginx | ||
|
||
``` | ||
mkdir ~/ingress | ||
cd ~/ingress | ||
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx | ||
helm repo update | ||
helm pull ingress-nginx/ingress-nginx --version 3.29.0 | ||
``` | ||
|
||
创建 values.yaml | ||
|
||
``` | ||
controller: | ||
hostNetwork: true | ||
service: | ||
externalIPs: | ||
- 172.26.117.104 | ||
image: | ||
repository: registry.hisun.netwarps.com/bitnami/nginx-ingress-controller | ||
tag: 0.44.0 | ||
digest: sha256:278ad67a8f9f2008d213c86c43c3f37f69ccdecfded91bf57aaab3e4cd6ebc58 | ||
admissionWebhooks: | ||
patch: | ||
image: | ||
repository: registry.hisun.netwarps.com/jettech/kube-webhook-certgen | ||
kind: DaemonSet | ||
tolerations: | ||
- effect: NoSchedule | ||
operator: Exists | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: node-role.kubernetes.io/master | ||
operator: Exists | ||
``` | ||
|
||
安装 ingress | ||
|
||
``` | ||
helm upgrade --install ingress-nginx ingress-nginx-3.29.0.tgz -f values.yaml -n ingress --create-namespace | ||
``` | ||
|
||
检测安装的版本 | ||
|
||
``` | ||
# 查看pod状态 | ||
kubectl get pod -n ingress | ||
# 获取pod name | ||
POD_NAME=$(kubectl get pods -l app.kubernetes.io/name=ingress-nginx -o jsonpath='{.items[0].metadata.name}' -n ingress) | ||
kubectl exec -it $POD_NAME -- /nginx-ingress-controller --version -n ingress | ||
# 查看 版本 | ||
kubectl -n ingress exec -it $POD_NAME -- /nginx-ingress-controller --version | ||
``` |
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
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