coreos-kubernetes icon indicating copy to clipboard operation
coreos-kubernetes copied to clipboard

[Windows] single-node vagrant up fails

Open AlexChesser opened this issue 9 years ago • 13 comments

after cloning the repo and running the vagrant up command

PS C:\www\coreos-kubernetes\single-node> vagrant up    
'.' is not recognized as an internal or external command,    
operable program or batch file.    
failed generating SSL CA artifacts

a directory list after the batch file runs looks like

d-----       2015-11-19   5:27 PM                -p   
d-----       2015-11-19   5:07 PM                .vagrant   
d-----       2015-11-19   5:07 PM                ssl   
-a----       2015-11-19   5:07 PM             14 .gitignore   
-a----       2015-11-19   5:07 PM            297 README.md   
-a----       2015-11-19   5:07 PM          15833 user-data   
-a----       2015-11-19   5:07 PM           2189 Vagrantfile   

AlexChesser avatar Nov 19 '15 22:11 AlexChesser

manual steps to fix

comment out Vagrantfile lines 16, 17, 18 requirement - Git SCM with UNIX TOOLS options added to the math set system environment variable OPENSSL_CONF=C:\Program Files (x86)\Git\ssl\openssl.cnf

mkdir ssl   
openssl genrsa -out ca-key.pem 2048   
openssl  req -x509 -new -nodes -key "ca-key.pem" -days 2037 -out "ca.pem" -subj "/CN=kube-ca" -config "C:\Program Files (x86)\Git\ssl\openssl.cnf"

note that the days command cannot be pushed past 2038 on windows https://forums.openvpn.net/topic2176.html

... continued in next comment (debug info to be continued in next comment)

AlexChesser avatar Nov 19 '15 23:11 AlexChesser

changed tactics from above. ssl certificate above created successfully

  • open git bash
  • change directoy to /c/www/coreos-kubernetes/single-node
  • edit file ../lib/init-ssl change line 5 to OPENSSL="openssl" (open ssl available in path)
  • run command ./../lib/init-ssl ssl apiserver controller IP.1=172.17.4.99,IP.2=10.3.0.1
  • run command ./../lib/init-ssl ssl admin kube-admin

Got error on creation of both init-ssl certs

Generating SSL artifacts in ssl
ssl/admin-key.pem
Loading 'screen' into random state - done
Generating RSA private key, 2048 bit long modulus
...................+++
..+++
e is 65537 (0x10001)
Loading 'screen' into random state - done
Subject does not start with '/'.
problems making Certificate Request

AlexChesser avatar Nov 19 '15 23:11 AlexChesser

edit line 70 of ../lib/init-ssl add additional forward slash character in front of "/CN

 $OPENSSL req -new -key "$KEYFILE" -out "$CSRFILE" -subj "//CN=$CN" -config "$CONFIGFILE"

AlexChesser avatar Nov 20 '15 00:11 AlexChesser

after re running the init-ssl commands above with corrected script vagrant up works in powershell on windows.

there may be ways to improve this a little.

AlexChesser avatar Nov 20 '15 00:11 AlexChesser

I've started tracking the steps required to make this work as expected in a branch. With the steps found here: https://github.com/AlexChesser/coreos-kubernetes/commit/64286a154a5a10a384a119fb88abb4253b872cd7

I am able to get further in the machine startup process

There are some errors which may be related to version 4.3 of virtualbox vs 5.0.10

PS C:\www\coreos-kubernetes\single-node> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'coreos-alpha'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'coreos-alpha' is up to date...
==> default: Setting the name of the VM: single-node_default_1448031537191_39481
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.

will continue after updating virtualbox (and restarting)

AlexChesser avatar Nov 20 '15 15:11 AlexChesser

VirtualBox 5+ worked with vagrant up.

next steps:

PS C:\www\coreos-kubernetes\single-node> vagrant up
PS C:\www\coreos-kubernetes\single-node> vagrant ssh
CoreOS alpha (845.0.0)
core@localhost ~ $ curl -L -O https://github.com/kubernetes/kubernetes/releases/download/v1.1.2/kubernetes.tar.gz
core@localhost ~ $ tar -xvf kubernetes.tar.gz

from here I can't find the connection to the SSL file as expected in the docs. maybe if I figure out how to mount the directory

core@localhost ~ $ ARCH=linux; wget https://storage.googleapis.com/kubernetes-release/release/v1.0.6/bin/$ARCH/amd64/kubectl 

works.

AlexChesser avatar Nov 20 '15 15:11 AlexChesser

Hi Alex,

In the vagrant scripts the SSL assets should be copied to the host for you as part of the provisioning step. They would be located in /etc/kubernetes/ssl

See: https://github.com/coreos/coreos-kubernetes/blob/master/single-node/Vagrantfile#L57

aaronlevy avatar Nov 23 '15 18:11 aaronlevy

Hi @AlexChesser any progress on getting this working from Windows?

aaronlevy avatar Dec 04 '15 19:12 aaronlevy

The Vagrantfile uses system commands which results in Windows commands getting executed, not Mac/Linux commands. I took the system commands out of the Vagrantfile and ran them as a shell script separately in Git Bash before running vagrant up:

#!/bin/bash

CLUSTER_IP="10.3.0.1"
NODE_IP="172.17.4.99"

mkdir -p ssl && ./../lib/init-ssl-ca ssl
./../lib/init-ssl ssl apiserver controller IP.1="${NODE_IP}",IP.2="${CLUSTER_IP}"
./../lib/init-ssl ssl admin kube-admin

You can run kubectl from within the VM. Upon downloading the binary, it appears that there is no need for configuration for kubectl to work, but here's some info if you need to: https://coreos.com/kubernetes/docs/latest/configure-kubectl.html

huangsam avatar Dec 04 '15 20:12 huangsam

Hi @aaronlevy Indeed I did get this working in windows, but haven't gone so far as to make it work "cross-platform" or automatically.

Like @huangsam says, I made the same changes locally (as you can see in this commit) https://github.com/AlexChesser/coreos-kubernetes/commit/64286a154a5a10a384a119fb88abb4253b872cd7

So the steps are to remove the system commands and run the SSL commands in git-bash.

Though unlike Sam I also had to slightly edit the scripts as well.

I'm not quite sure what you'd be interested in terms of fixing that. Is documenting the differences enough or can the vagrant scripts be tuned to run correctly? I'm not quite up to speed on vagrant syntax. Is there even a way to detect whether the host system is windows vs. mac/linux?

AlexChesser avatar Dec 05 '15 20:12 AlexChesser

hi @AlexChesser, i followed your steps and successfully launched the single node vagrant on windows. I wonder if you tried the multi node vagrant before? I have no luck of generating the ssl certificate. It kept stating fail generating ssl artifacts. How should i run "./../../lib/init-ssl ssl #{certBaseName} #{cn} #{ipString}" ??

8kigai avatar May 08 '16 09:05 8kigai

Hey @geekkean - sorry I haven't tried multinode.

AlexChesser avatar May 09 '16 13:05 AlexChesser

I also encountered this issue when I ran vagrant up under bash in Cygwin. See https://groups.google.com/d/topic/coreos-dev/QsKTDFHx3cE/discussion.

derekmahar avatar Sep 01 '16 16:09 derekmahar