terraform-kubernetes-installer icon indicating copy to clipboard operation
terraform-kubernetes-installer copied to clipboard

Should this work on windows

Open jferr opened this issue 7 years ago • 8 comments
trafficstars

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.

  • template_file.etcd_discovery_url: 1 error(s) occurred:

  • Error running command '[ -d C:\t_oracle/generated ] || mkdir -p C:\t_oracle/generated && curl --retry 3 https://discovery.etcd.io/new?size=3 > C:\t_oracle/generated/discoverye3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855': exit status 1. Output: The syntax of the command is incorrect.

jferr avatar Jan 16 '18 16:01 jferr

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

jferr avatar Jan 19 '18 15:01 jferr

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.

jlamillan avatar Jan 19 '18 18:01 jlamillan

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!

udora avatar Jan 23 '18 22:01 udora

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

Prerequisites

  • Install Docker
  • Download and install the Linux version of the OCI Terraform Provider to your terraform-kubernetes-installer directory (I.e. a file called something like terraform-provider-oci_v2.0.6)
  • Download the Linux version of kubectl to your terraform-kubernetes-installer directory.

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

jlamillan avatar Jan 24 '18 01:01 jlamillan

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

udora avatar Jan 30 '18 01:01 udora

@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.

jrosinsk avatar Jan 30 '18 01:01 jrosinsk

@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.

udora avatar Jan 30 '18 01:01 udora

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)

jferr avatar Mar 07 '18 20:03 jferr