Commit Graph

21 Commits

Author SHA1 Message Date
iwilltry42
6e05342812
Merge branch 'master' of https://github.com/rancher/k3d into feature/add-node-command 2020-01-02 14:42:12 +01:00
iwilltry42
469b56c253 replace 'default' with clustername in kubeconfig 2019-11-11 11:53:22 +01:00
Simon Lutz Brüggen
2205264a11 Fix kubeconfig not pointing to correct host
The kubeconfig generated by docker.io/rancher/k3s:v0.10.2 or earlier
sets the cluster.server address to 127.0.0.1. Previously this seems to
have been localhost. And we only replace localhost with the correct
address for our local kubeconfig.

The error this can lead to:
```
$ k3d --version
k3d version v1.3.4
$ docker-machine --version
docker-machine version 0.16.1, build cce350d7
$ docker --version
Docker version 19.03.1, build 74b1e89
$ k3d create
INFO[0000] Created cluster network with ID 649d6f34b84a4df16d2524f0ea0ce69cd4f964a79ae56e2a07bb1ee11d1fce50
INFO[0001] Add TLS SAN for 192.168.99.100
INFO[0001] Created docker volume  k3d-k3s-default-images
INFO[0001] Creating cluster [k3s-default]
INFO[0001] Creating server using docker.io/rancher/k3s:v0.10.2...
INFO[0001] Pulling image docker.io/rancher/k3s:v0.10.2...
INFO[0018] SUCCESS: created cluster [k3s-default]
INFO[0018] You can now use the cluster with:

export KUBECONFIG="$(k3d get-kubeconfig --name='k3s-default')"
kubectl cluster-info
$ export KUBECONFIG="$(k3d get-kubeconfig --name='k3s-default')"
$ kubectl cluster-info

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?
```
2019-11-04 17:29:39 +01:00
iwilltry42
b9ea408d49 Merge branch 'master' of https://github.com/rancher/k3d into feature/add-node-command 2019-10-21 08:12:48 +02:00
iwilltry42
6d771a20fa error exit if no clusters found 2019-10-21 07:35:07 +02:00
iwilltry42
9aa5af8d5d improve log level usage 2019-10-02 19:06:36 +02:00
Nicolas Lamirault
61107ca5bf
Update: use log level
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
2019-09-28 19:58:05 +02:00
Nicolas Lamirault
3631e65570
Update: replace log with logrus
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
2019-09-25 22:41:00 +02:00
iwilltry42
89ba0f67b7 use --port/-p for publishing ports now instead of api-port 2019-09-04 18:09:36 +02:00
wxdao
058bb1d9e4 Use client.WithAPIVersionNegotiation() 2019-07-25 06:42:31 +00:00
wxdao
c1263487a5 Upgrade docker sdk 2019-07-25 03:15:28 +00:00
iwilltry42
f670dde640 test 2019-07-08 09:58:26 +02:00
iwilltry42
ab2c54ca1d add import-image command for importing single image 2019-07-01 11:31:35 +02:00
Andy Zhou
1080c0b157 Fix up kubeconfig.yaml with --api-port host 2019-06-03 17:51:55 -07:00
Andy Zhou
de6e845abd Support docker machine for kubeconfig.yaml
The kubeconfig.yaml generated by K3S uses local host as the host name by
default. It won't work when running with docker machine.

This patch detects if the docker environment is set up with docker
machine. If it is, then replace the host name to the IP address of
the docker machine.
2019-05-29 09:09:13 -07:00
Andy Zhou
4ef6710e22 Add basic bashShell() function
Add the basic frame work for supporting spawning a bash shell by cli
command.

With this change, we can spawn a bash shell in the context of a cluster

$ k3d create -n my-cluster
$ k3d bash -n my-cluster
[my-cluster] $>

// execute commands with KUBECONFIG already set up
[my-cluster] $> kubectl get pods
2019-05-24 17:16:12 -07:00
Andy Zhou
9f276a68f3 Add getKubeConfig()
Move the logic of retrive per cluster kube config file into
cli/cluster.go. Simplify the CLI handling code.
2019-05-24 17:16:12 -07:00
Andy Zhou
cdcc5e1de6 Add createKubeconfigFile()
Refactoring. Make createKubeconfigFile() a stand along function, so we
don't have to recreate the file every time we look up the file name.
2019-05-24 17:16:12 -07:00
Andy Zhou
1eff974064 Add getClusterKubeConfigPath()
Minor refactor. Add getClusterKubeConfigOath() to make logic reusable
for later changes.
2019-05-24 17:16:12 -07:00
Andy Zhou
01931b5894 Make list command always show all clusters. Remove --all option
It feels more natural to have the list command show all clusters by
default.
2019-05-18 22:25:24 -07:00
Andy Zhou
10c6eeeea5 Rename cli/config.go to cli/cluster.go
Config.go mainly contains functions around the cluster data structure. Rename
the file to cluster.go
2019-05-16 20:07:09 -07:00