oracle / terraform-kubernetes-installer

Terraform Installer for Kubernetes on Oracle Cloud Infrastructure
Other
179 stars 118 forks source link

Should this work on windows #99

Open jferr opened 6 years ago

jferr commented 6 years ago

using the latest "master" version I'm seeing errors that imply to me that this might not work on windows...

kubectl config use-context bmcs-k8s-context ': exit status 1. Output: 'export' is not recognized as an internal or external command, operable program or batch file.

jferr commented 6 years ago

Just a followup to this. I set this up to run via docker (hashicorp/terraform as my base image then installing kubectl/setting up the vars/keys etc) and it works fine. Perhaps at a minimum if this can be confirmed it should be added to the documentation

jlamillan commented 6 years ago

jferr,

Thanks for the bug report. We're not regularly testing on Windows, so it's not surprising that there appear to be some issues. I like your recommendation about running Terraform in a docker container.

If you're willing to share the instructions / steps you followed in this bug (or a PR), we could add them to the docs.

udora commented 6 years ago

Got the same error after configuring and running installer on my Windows laptop. @jferr Would love instructions/pointers to run it via Docker if available. Thanks!

jlamillan commented 6 years ago

I tried this out on the mac and it seemed to work well:

Prerequisites

Create a terraform.tfvars file in your your terraform-kubernetes-installer directory that specifies your configuration.

Run the following commands substituting the values of <value of private_key_path> and <path to cloned repo> to match your environment.

Initialize Terraform using the terraform container:

$ docker run --rm -it -v <path to cloned repo>:/tf-k8s-installer  --workdir=/tf-k8s-installer hashicorp/terraform:light init

Terraform plan using the terraform container:

$ docker run --rm -it -v <path to cloned repo>:/tf-k8s-installer  -v <value of private_key_path>:<value of private_key_path> --workdir=/tf-k8s-installer hashicorp/terraform:light plan

Terraform apply using the terraform container:

$ docker run --rm -it -v <path to cloned repo>:/tf-k8s-installer  -v <value of private_key_path>:<value of private_key_path> -v <path to cloned repo>/terraform-kubernetes-installer/kubectl:/bin/kubectl --workdir=/tf-k8s-installer hashicorp/terraform:light apply
udora commented 6 years ago

Tried the steps, can't seem to get past the following:

$ docker run --rm -it -v /d/terraform/terraform-kubernetes-installer:/tf-ud --workdir=/tf-ud hashicorp/terraform:light init Terraform initialized in an empty directory!

The directory has no Terraform configuration files. You may begin working with Terraform immediately by creating Terraform configuration files.

There seems to be an issue recognizing my 'workdir'. I'm running the command in Docker (I have a Windows 7 64-bit machine, installed Docker Toolbox and validated that it's working correctly, also installed and validated the hashicorp/terraform image).

udhamija@udhamija-t440p MINGW64 /d/terraform/terraform-kubernetes-installer (master) $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hashicorp/terraform latest bc81c3676fd0 2 weeks ago 102MB hashicorp/terraform light bc81c3676fd0 2 weeks ago 102MB hello-world latest f2a91732366c 2 months ago 1.85kB

jrosinsk commented 6 years ago

@udora is using the docker toolbox.

Docker toolbox is for older versions of windows.

I think the next step would be to try using 'Docker for Windows' instead of the Docker toolbox.

Might be more straight forward.

udora commented 6 years ago

@jrosinsk 'Docker Toolbox' is for Windows 7, 'Docker for Windows' is for Windows 10. With that said, I tried running the 'Docker for Windows' exe on my laptop regardless, it doesn't run (nothing happens).

See: https://docs.docker.com/toolbox/toolbox_install_windows/

As part of the config, I also made sure to set a shared folder in VBox to point to the to terraform-kubernetes-installer dir.

jferr commented 6 years ago

I've been using this on windows via docker for windows. here's my setup https://github.com/jferr/oci_tf_kuber

FYI I put that up in github for Oracle Support to duplicate a problem so I won't be maintaining (I've got a local version that my company uses in a private git repo which is a bit different)