Skip to content

Commit

Permalink
fix: ansible.hosts.tpl
Browse files Browse the repository at this point in the history
  • Loading branch information
ss75710541 committed Sep 9, 2021
1 parent 7c6ce76 commit 160624c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ansible.hosts.ha.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ api_server_domain="api-server.{{node_domain}}"
api_server_port="6443"

# k8s 版本
k8s_version=1.21.6
k8s_version=1.21.4
# 定义外部镜像仓库
registry_domain=docker.io
registry_repo="{{registry_domain}}"
Expand Down
2 changes: 1 addition & 1 deletion ansible.hosts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ api_server_domain="api-server.{{node_domain}}"
api_server_port="6443"

# k8s 版本
k8s_version=1.21.6
k8s_version=1.21.4
# 定义外部镜像仓库
registry_domain=registry.hisun.netwarps.com
registry_repo="{{registry_domain}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 使用公有云跨机房公网搭建k8s 1.21.6
# 使用公有云跨机房公网搭建k8s 1.21.4

## 下载 ansible-k8s

Expand All @@ -13,7 +13,7 @@ git clone https://github.com/paradeum-team/ansible-k8s.git

```
cd /data/ansible-k8s/
cp ansible.hosts.ha.tpl ansible.hosts.tmp
cp ansible.hosts.tpl ansible.hosts.tmp
```

修改 `ansible.hosts.tmp` 如下
Expand Down Expand Up @@ -52,7 +52,7 @@ api_server_domain="api-server.{{node_domain}}"
api_server_port="6443"
# k8s 版本
k8s_version=1.21.6
k8s_version=1.21.4
# 定义外部镜像仓库
registry_domain=registry.hisun.netwarps.com
registry_repo="{{registry_domain}}"
Expand Down Expand Up @@ -102,3 +102,60 @@ node1.solarfs.k8s ansible_host=8.142.71.142 advertise_address="8.142.71.142"
```
./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
```

0 comments on commit 160624c

Please sign in to comment.