2019-11-11 19:17:22 +00:00
|
|
|
See the [release](https://github.com/rancher/k3s/releases/latest) page for pre-built releases.
|
|
|
|
|
|
|
|
The clone will be much faster on this repo if you do
|
|
|
|
|
2020-03-04 09:47:40 +00:00
|
|
|
```bash
|
|
|
|
git clone --depth 1 https://github.com/rancher/k3s.git
|
|
|
|
```
|
2019-11-11 19:17:22 +00:00
|
|
|
|
|
|
|
This repo includes all of Kubernetes history so `--depth 1` will avoid most of that.
|
|
|
|
|
|
|
|
To build the full release binary run `make` and that will create `./dist/artifacts/k3s`.
|
|
|
|
|
2019-11-14 10:54:50 +00:00
|
|
|
Optionally to build the binaries using local go environment without running linting or building docker images:
|
2020-03-04 09:47:40 +00:00
|
|
|
|
|
|
|
```bash
|
2019-11-11 19:17:22 +00:00
|
|
|
./scripts/download && ./scripts/build && ./scripts/package-cli
|
|
|
|
```
|
|
|
|
|
2019-11-14 10:54:50 +00:00
|
|
|
For development, you just need go 1.12+ and a proper GOPATH. To compile the binaries run:
|
2020-03-04 09:47:40 +00:00
|
|
|
|
2019-11-11 19:17:22 +00:00
|
|
|
```bash
|
|
|
|
go build -o k3s
|
|
|
|
go build -o kubectl ./cmd/kubectl
|
|
|
|
go build -o hyperkube ./vendor/k8s.io/kubernetes/cmd/hyperkube
|
|
|
|
```
|
|
|
|
|
|
|
|
This will create the main executable at `./dist/artifacts` , but it does not include the dependencies like containerd, CNI,
|
|
|
|
etc. To run a server and agent with all the dependencies for development run the following
|
|
|
|
helper scripts:
|
2020-03-04 09:47:40 +00:00
|
|
|
|
2019-11-11 19:17:22 +00:00
|
|
|
```bash
|
|
|
|
# Server
|
|
|
|
./scripts/dev-server.sh
|
|
|
|
|
|
|
|
# Agent
|
|
|
|
./scripts/dev-agent.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Kubernetes Source
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
The source code for Kubernetes is in `vendor/` and the location from which that is copied
|
2019-11-14 10:54:50 +00:00
|
|
|
is in `./go.mod`. Go to the referenced repo/tag and you'll find all the patches applied
|
2019-11-11 19:17:22 +00:00
|
|
|
to upstream Kubernetes.
|
2020-03-04 09:47:40 +00:00
|
|
|
|