Adjust k8s

This commit is contained in:
mr
2026-01-20 16:21:04 +01:00
parent f52bdf8ecc
commit 4ff6e706ca
18 changed files with 272 additions and 1799 deletions

View File

@@ -9,10 +9,12 @@ func Help_K3S() {
fmt.Println(`
K3S commands: oc-k8s <action> k3s
install - Install k3s
create - Create a new cluster
help - Show this help message
Usage:
oc-k8s install k3s
oc-k8s create k3s
oc-k8s help values `)
}
@@ -22,12 +24,16 @@ func Install_K3S() error {
if err := utils.Exec("curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644"); err != nil {
return err
}
utils.Exec("yes | sudo cp -rf /etc/rancher/k3s/k3s.yaml ~/.kube/config")
utils.Exec("chmod 700 /home/mr/.kube")
utils.Exec("sudo chmod 600 ~/.kube/config")
Create_K3S()
if err := utils.Exec("sudo systemctl status k3s"); err != nil {
return err
}
return utils.Exec("chmod 600 ~/.kube/config")
}
func Create_K3S() error {
utils.Exec("yes | sudo cp -rf /etc/rancher/k3s/k3s.yaml ~/.kube/config")
utils.Exec("chmod 700 /home/mr/.kube")
return utils.Exec("chmod 600 ~/.kube/config")
}