This commit is contained in:
tianyiliu 2024-11-18 17:44:43 +08:00
Родитель 0930f70f6d
Коммит 560a83fe94
3 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -7,10 +7,6 @@ $joinedServers = $servers -join ' '
clusrun /nodes:$($servers[0]) "git clone https://github.com/Azure/hpcpack.git && cd hpcpack && git checkout tianyiliu/deploy-Kubernetes-script && chmod +x Scripts/Deploy-Kubernetes.sh"
clusrun /nodes:$($servers[0]) "hpcpack/Scripts/Deploy-Kubernetes.sh -p '$password' $joinedServers"
try {
New-HpcGroup -Name "Kubernetes"
} catch {
write-host "Group Kubernetes already exists"
}
New-HpcGroup -Name "Kubernetes" -ErrorAction SilentlyContinue
Add-HpcGroup -Name "Kubernetes" -NodeName $servers

Просмотреть файл

@ -16,7 +16,7 @@ Replace `{password}` with your password and `{servers}` with your node names sep
|------------|---------------------------------|--------------------------------|
| **Deployment** | Uses [Kubespray](https://github.com/kubernetes-sigs/kubespray) to deploy a Kubernetes cluster, providing flexibility to modify the script and install plugins. | Uses [kubeadm](https://github.com/kubernetes/kubeadm) to deploy a Kubernetes cluster, which does not support customization. |
| **Output** | Runs a shell within a `clusrun` command, so there will be no output until the whole shell script completes. | Provides output as soon as a single `clusrun` command finishes. |
| **Master Node Selection** | Selects the master node or etcl node based on its own algorithm. To configure this selection manually, modify the `inventory/mycluster/hosts.yaml` file. | Selects the first server in `servers` as the master node. |
| **Master Node Selection** | Selects the control-plane nodes based on its own algorithm. To configure this selection manually, modify the `inventory/mycluster/hosts.yaml` file. | Selects the first server in `servers` as the control-plane node. |
| **Time** | Takes more time to deploy a cluster of the same scale. | Takes less time to deploy a cluster of the same scale. |
## KubernetesWrapper

Просмотреть файл

@ -35,7 +35,10 @@ namespace KubernetesWrapper
string? homeDirectory = Environment.GetEnvironmentVariable("HOME");
homeDirectory ??= "~";
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile($"~/.kube/config");
string kubeConfigPath = $"{homeDirectory}/.kube/config";
Console.WriteLine($"Home directory: {homeDirectory}");
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(kubeConfigPath);
IKubernetes client = new Kubernetes(config);
var nodes = Environment.GetEnvironmentVariable("CCP_NODES");