Giter Site home page Giter Site logo

Comments (6)

koushik82 avatar koushik82 commented on June 26, 2024

The commands don’t work in Windows because:

  • There’s no implicit line wrap due to double quotes in cmd.exe, so echo fails to create a valid certificate file.

  • The backslash doesn’t work as a line wrap either in cmd.exe. Even if echo was modified to create the certificate file, using echo results in Windows line feeds which makes embedded certificates invalid and subsequent commands fail due to invalid x509 cert. It needs to be converted to use UNIX new lines before embedding and base64 encoding.

from gangway.

meilel avatar meilel commented on June 26, 2024

Would be very useful to have Windows instructions. Because most of our devs work on a windows os.

from gangway.

jimangel avatar jimangel commented on June 26, 2024

Additional issues:

  • stdout redirection creating the CA

Suggestion:
We could have 2 info boxes (PowerShell and BASH or Windows and Mac / Linux). My preference would be to model around PowerShell vs. CMD.

I'll help work on this if it doesn't get a ton of traction.

from gangway.

jbrunner avatar jbrunner commented on June 26, 2024

This could be fixed together with #136.

Do you have a PS example? For both, installing kubectl and kubectl config?

from gangway.

mrwonkerz avatar mrwonkerz commented on June 26, 2024

@jbrunner

Defently not perfect but this should work...

Install-Script -Name install-kubectl -Scope CurrentUser -Force
New-Item -Path 'C:\Program Files\Kubectl' -ItemType Directory
install-kubectl.ps1 -DownloadLocation 'C:\Program Files\Kubectl'


$ClusterCA = "{{ .ClusterCA }}"
Set-Content -Path ca-{{ .ClusterName }}.pem -Value $ClusterCA
kubectl config set-cluster {{ .ClusterName }} --server={{ .APIServerURL }} --certificate-authority=ca-{{ .ClusterName }}.pem --embed-certs
kubectl config set-credentials {{ .KubeCfgUser }}  `
    --auth-provider=oidc  `
    --auth-provider-arg='idp-issuer-url={{ .IssuerURL }}'  `
    --auth-provider-arg='client-id={{ .ClientID }}'  `
    --auth-provider-arg='client-secret={{ .ClientSecret }}' `
    --auth-provider-arg='refresh-token={{ .RefreshToken }}' `
    --auth-provider-arg='id-token={{ .IDToken }}'
kubectl config set-context {{ .ClusterName }} --cluster={{ .ClusterName }} --user={{ .KubeCfgUser }}
kubectl config use-context {{ .ClusterName }}
Remove-Item ca-{{ .ClusterName }}.pem

from gangway.

jimangel avatar jimangel commented on June 26, 2024

Semi-hacky but a manual alternative (if the user can't run scripts outside company):

## INSTALL KUBECTL IN POWERSHELL ##
# Create a folder ‘k’ in C:\ for kubectl.exe
New-Item -ItemType directory -Path "C:\k"

# Make the ‘k’ folder executable by adding it to your user’s $PATH
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\k", [EnvironmentVariableTarget]::User)

# Start a new PowerShell session to see your changes take place.

# Validate that C:\k is now in your path
$env:PATH

# Download the windows kubectl client from your browser
https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/windows/amd64/kubectl.exe

# Move kubectl.exe to C:\k folder that was created in [Step 2]

The above example looks like a clean way to setup kubectl, the biggest problem was the CA cert and setting it as a var would solve that potentially.

from gangway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.