From 157447e78a6c2f84039bb87074bff1a54025e195 Mon Sep 17 00:00:00 2001 From: jonas Date: Thu, 13 Mar 2025 07:59:05 +0000 Subject: [PATCH] Update .gitea/workflows/k3s.yaml --- .gitea/workflows/k3s.yaml | 80 --------------------------------------- 1 file changed, 80 deletions(-) diff --git a/.gitea/workflows/k3s.yaml b/.gitea/workflows/k3s.yaml index 408b310..e69de29 100644 --- a/.gitea/workflows/k3s.yaml +++ b/.gitea/workflows/k3s.yaml @@ -1,80 +0,0 @@ -name: k3s - -on: - push: - branches: [ "main" ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install kubectl - env: - K3S_TOKEN: ${{ secrets.K3S_TOKEN }} - K3S_CERT: ${{ secrets.K3S_CERT }} - shell: bash - run: | - # Fetch the latest stable version of kubectl - KUBECTL_VERSION=$(curl -s https://dl.k8s.io/release/stable.txt) - if [ -z "$KUBECTL_VERSION" ]; then - echo "Failed to fetch the latest kubectl version. Exiting." - exit 1 - fi - - # Download kubectl binary - curl -LO "https://dl.k8s.io/release/v1.31.0/bin/linux/amd64/kubectl" - if [ $? -ne 0 ]; then - echo "Failed to download kubectl binary. Exiting." - exit 1 - fi - - # Make kubectl executable and move to PATH - chmod +x kubectl - sudo mv kubectl /usr/local/bin/ - - # Verify kubectl installation - kubectl version --client - - # Install kubelogin - curl -fsSLO https://github.com/int128/kubelogin/releases/download/v1.25.4/kubelogin_linux_amd64.zip - unzip kubelogin_linux_amd64.zip kubelogin -d kubelogin - mv kubelogin/kubelogin kubelogin/kubectl-oidc_login - export PATH=$PATH:$(realpath kubelogin) - - # Create the kubeconfig file with the K3S_TOKEN and K3S_CERT - mkdir -p ~/.kube - - # Base64 decode the K3S_CERT and write it to a file - echo "$K3S_CERT" | base64 --decode > ~/.kube/ca.crt - - # Create the kubeconfig file - cat < ~/.kube/config -apiVersion: v1 -kind: Config -clusters: -- name: k3s-cluster - cluster: - certificate-authority: ~/.kube/ca.crt - server: https://kubernetes.default.svc:6443 -users: -- name: k3s-user - user: - token: $K3S_TOKEN -contexts: -- name: k3s-context - context: - cluster: k3s-cluster - user: k3s-user -current-context: k3s-context -EOF - - # Test the kubeconfig setup by printing the cluster info - kubectl cluster-info - - # Apply Kubernetes configuration - kubectl delete -f kubernetes.yaml - kubectl apply -f kubernetes.yaml