k8s #1
@@ -224,21 +224,33 @@ def main():
|
|||||||
|
|
||||||
if addons.get('istio'):
|
if addons.get('istio'):
|
||||||
print(" - Installing Istio")
|
print(" - Installing Istio")
|
||||||
run_cmd(f"istioctl install -y --set profile=demo --context kind-{name}")
|
# Генерируем kubeconfig и заменяем 0.0.0.0 на IP control-plane узла
|
||||||
|
run_cmd(f"kind get kubeconfig --name {name} > /tmp/istio-kubeconfig-{name}.yaml")
|
||||||
|
# Получаем IP control-plane узла и заменяем в kubeconfig
|
||||||
|
result = subprocess.run(f"docker inspect {name}-control-plane --format='{{{{.NetworkSettings.Networks.kind.IPAddress}}}}'",
|
||||||
|
shell=True, capture_output=True, text=True)
|
||||||
|
if result.returncode == 0:
|
||||||
|
control_plane_ip = result.stdout.strip()
|
||||||
|
# Заменяем 0.0.0.0 на IP control-plane
|
||||||
|
subprocess.run(f"sed -i 's/0\\.0\\.0\\.0:6443/{control_plane_ip}:6443/g' /tmp/istio-kubeconfig-{name}.yaml", shell=True)
|
||||||
|
# Устанавливаем Istio используя kubeconfig
|
||||||
|
run_cmd(f"KUBECONFIG=/tmp/istio-kubeconfig-{name}.yaml istioctl install -y --set profile=demo")
|
||||||
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify -n istio-system rollout status deploy/istiod --timeout=180s")
|
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify -n istio-system rollout status deploy/istiod --timeout=180s")
|
||||||
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify -n istio-system rollout status deploy/istio-ingressgateway --timeout=180s")
|
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify -n istio-system rollout status deploy/istio-ingressgateway --timeout=180s")
|
||||||
|
|
||||||
if addons.get('kiali'):
|
if addons.get('kiali'):
|
||||||
print(" - Installing Kiali")
|
print(" - Installing Kiali")
|
||||||
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify create ns istio-system")
|
subprocess.run(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify create ns istio-system", shell=True, capture_output=True)
|
||||||
run_cmd(f"helm upgrade --install kiali-server kiali/kiali-server --namespace istio-system --kube-context kind-{name} --set auth.strategy=anonymous --wait --timeout 180s")
|
# Используем исправленный kubeconfig
|
||||||
|
run_cmd(f"KUBECONFIG=/tmp/istio-kubeconfig-{name}.yaml helm upgrade --install kiali-server kiali/kiali-server --namespace istio-system --set auth.strategy=anonymous --wait --timeout 180s")
|
||||||
|
|
||||||
if addons.get('prometheus_stack'):
|
if addons.get('prometheus_stack'):
|
||||||
print(" - Installing Prometheus Stack")
|
print(" - Installing Prometheus Stack")
|
||||||
run_cmd(f"helm repo add prometheus-community https://prometheus-community.github.io/helm-charts")
|
run_cmd(f"helm repo add prometheus-community https://prometheus-community.github.io/helm-charts")
|
||||||
run_cmd(f"helm repo update")
|
run_cmd(f"helm repo update")
|
||||||
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify create ns monitoring")
|
subprocess.run(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify create ns monitoring", shell=True, capture_output=True)
|
||||||
run_cmd(f"helm upgrade --install monitoring prometheus-community/kube-prometheus-stack --namespace monitoring --kube-context kind-{name} --set grafana.adminPassword=admin --set grafana.defaultDashboardsTimezone=browser --wait --timeout 600s")
|
# Используем исправленный kubeconfig
|
||||||
|
run_cmd(f"KUBECONFIG=/tmp/istio-kubeconfig-{name}.yaml helm upgrade --install monitoring prometheus-community/kube-prometheus-stack --namespace monitoring --set grafana.adminPassword=admin --set grafana.defaultDashboardsTimezone=browser --wait --timeout 600s")
|
||||||
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify -n monitoring rollout status deploy/monitoring-grafana --timeout=300s")
|
run_cmd(f"kubectl --server=https://{name}-control-plane:6443 --insecure-skip-tls-verify -n monitoring rollout status deploy/monitoring-grafana --timeout=300s")
|
||||||
|
|
||||||
# Настраиваем NodePort для аддонов
|
# Настраиваем NodePort для аддонов
|
||||||
|
|||||||
Reference in New Issue
Block a user