Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Add command line instructions for users running on Windows #102

Open
alexbrand opened this issue Jan 23, 2019 · 6 comments · May be fixed by #137
Open

Add command line instructions for users running on Windows #102

alexbrand opened this issue Jan 23, 2019 · 6 comments · May be fixed by #137

Comments

@alexbrand
Copy link
Contributor

The commands displayed by gangway assume that the user is running a UNIX-based system.

Add instructions for downloading/configuring kubectl that work on Windows.

@koushik82
Copy link

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.

@meilel
Copy link

meilel commented May 21, 2019

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

@jimangel
Copy link

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.

@jbrunner
Copy link

This could be fixed together with #136.

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

@mrwonkerz
Copy link

mrwonkerz commented Sep 10, 2019

@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

@jimangel
Copy link

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.

jbrunner added a commit to jbrunner/gangway that referenced this issue Sep 11, 2019
- Serve CSS/JS files localy. Resolves vmware-archive#102
- Copy to clipboard button is placed more prominently
- Places install instructions below the config instruction
- Add command line instructions for users running on Windows. Resolves vmware-archive#102

Signed-off-by: Joshua Brunner <joshua.brunner@bluewin.ch>
@jbrunner jbrunner linked a pull request Sep 11, 2019 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants