mirror of
https://github.com/batonogov/learn-devops.git
synced 2025-11-29 08:43:01 +00:00
Add kubeadm example (#4)
* Add kubeadm example * Fix dns --------- Co-authored-by: Fedor Batonogov <f.batonogov@yandex.ru>
This commit is contained in:
committed by
GitHub
parent
346360f820
commit
07fb0c68bf
11
ansible/roles/haproxy_static_pods/files/check_apiserver.sh
Normal file
11
ansible/roles/haproxy_static_pods/files/check_apiserver.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
errorExit() {
|
||||
echo "*** $*" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
curl --silent --max-time 2 --insecure https://localhost:7443/ -o /dev/null || errorExit "Error GET https://localhost:7443/"
|
||||
if ip addr | grep -q 10.0.70.85; then
|
||||
curl --silent --max-time 2 --insecure https://10.0.70.85:7443/ -o /dev/null || errorExit "Error GET https://10.0.70.85:7443/"
|
||||
fi
|
||||
52
ansible/roles/haproxy_static_pods/files/haproxy.cfg
Normal file
52
ansible/roles/haproxy_static_pods/files/haproxy.cfg
Normal file
@@ -0,0 +1,52 @@
|
||||
# /etc/haproxy/haproxy.cfg
|
||||
#---------------------------------------------------------------------
|
||||
# Global settings
|
||||
#---------------------------------------------------------------------
|
||||
global
|
||||
log /dev/log local0
|
||||
log /dev/log local1 notice
|
||||
daemon
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# common defaults that all the 'listen' and 'backend' sections will
|
||||
# use if not designated in their block
|
||||
#---------------------------------------------------------------------
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
option dontlognull
|
||||
option http-server-close
|
||||
option forwardfor except 127.0.0.0/8
|
||||
option redispatch
|
||||
retries 1
|
||||
timeout http-request 10s
|
||||
timeout queue 20s
|
||||
timeout connect 5s
|
||||
timeout client 20s
|
||||
timeout server 20s
|
||||
timeout http-keep-alive 10s
|
||||
timeout check 10s
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# apiserver frontend which proxys to the control plane nodes
|
||||
#---------------------------------------------------------------------
|
||||
frontend apiserver
|
||||
bind *:7443
|
||||
mode tcp
|
||||
option tcplog
|
||||
default_backend apiserverbackend
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# round robin balancing for apiserver
|
||||
#---------------------------------------------------------------------
|
||||
backend apiserverbackend
|
||||
option httpchk GET /healthz
|
||||
http-check expect status 200
|
||||
mode tcp
|
||||
option ssl-hello-chk
|
||||
balance roundrobin
|
||||
server 10.0.70.70 10.0.70.70:6443 check
|
||||
server 10.0.70.78 10.0.70.78:6443 check
|
||||
server 10.0.70.79 10.0.70.79:6443 check
|
||||
# [...]
|
||||
27
ansible/roles/haproxy_static_pods/files/haproxy.yaml
Normal file
27
ansible/roles/haproxy_static_pods/files/haproxy.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: haproxy
|
||||
namespace: kube-system
|
||||
spec:
|
||||
containers:
|
||||
- image: haproxy:2.9.7
|
||||
name: haproxy
|
||||
livenessProbe:
|
||||
failureThreshold: 8
|
||||
httpGet:
|
||||
host: localhost
|
||||
path: /healthz
|
||||
port: 7443
|
||||
scheme: HTTPS
|
||||
volumeMounts:
|
||||
- mountPath: /usr/local/etc/haproxy/haproxy.cfg
|
||||
name: haproxyconf
|
||||
readOnly: true
|
||||
hostNetwork: true
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /etc/haproxy/haproxy.cfg
|
||||
type: FileOrCreate
|
||||
name: haproxyconf
|
||||
status: {}
|
||||
31
ansible/roles/haproxy_static_pods/files/keepalived.yaml
Normal file
31
ansible/roles/haproxy_static_pods/files/keepalived.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: keepalived
|
||||
namespace: kube-system
|
||||
spec:
|
||||
containers:
|
||||
- image: osixia/keepalived:2.0.20
|
||||
name: keepalived
|
||||
resources: {}
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- NET_ADMIN
|
||||
- NET_BROADCAST
|
||||
- NET_RAW
|
||||
volumeMounts:
|
||||
- mountPath: /usr/local/etc/keepalived/keepalived.conf
|
||||
name: config
|
||||
- mountPath: /etc/keepalived/check_apiserver.sh
|
||||
name: check
|
||||
hostNetwork: true
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /etc/keepalived/keepalived.conf
|
||||
name: config
|
||||
- hostPath:
|
||||
path: /etc/keepalived/check_apiserver.sh
|
||||
name: check
|
||||
status: {}
|
||||
Reference in New Issue
Block a user