github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/setup/kubeedge_install_source.md (about) 1 # Setup from Source Code 2 3 This guide provide steps which can be utilised to install KubeEdge Cloud and Edge side. At this point, we assume that you would have installed the [Pre-Requisite](develop_kubeedge.md#pre-requisite) for Cloud and Edge. 4 5 ## Setup Cloud Side (KubeEdge Master) 6 7 ### Clone KubeEdge 8 9 Setup [$GOPATH ](https://github.com/golang/go/wiki/SettingGOPATH) to clone the KubeEdge repository in the `$GOPATH`. 10 11 ```shell 12 git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge 13 cd $GOPATH/src/github.com/kubeedge/kubeedge 14 ``` 15 16 ### Generate Certificates 17 18 RootCA certificate and a cert/ key pair is required to have a setup for KubeEdge. Same cert/ key pair can be used in both cloud and edge. 19 20 ```bash 21 $GOPATH/src/github.com/kubeedge/kubeedge/build/tools/certgen.sh genCertAndKey edge 22 ``` 23 24 The cert/ key will be generated in the `/etc/kubeedge/ca` and `/etc/kubeedge/certs` respectively, so this command should be run with root or users who have access to those directories. Copy these files to the corresponding edge side server directory. 25 26 ### Compile Cloudcore 27 28 + Make sure a C compiler is installed on your host. The installation is tested with `gcc` and `clang`. 29 30 ```shell 31 gcc --version 32 ``` 33 34 + Build cloudcore 35 36 ```shell 37 cd $GOPATH/src/github.com/kubeedge/kubeedge/ 38 make all WHAT=cloudcore 39 ``` 40 41 **Note:** If you don't want to compile, you may perform the below step 42 43 + Download KubeEdge (latest or stable version) from [Releases](https://github.com/kubeedge/kubeedge/releases) 44 45 Download `kubeedge-$VERSION-$OS-$ARCH.tar.gz` from above link. It contains Cloudcore and the configuration files. 46 47 ### Create DeviceModel and Device CRDs. 48 49 ```shell 50 cd $GOPATH/src/github.com/kubeedge/kubeedge/build/crds/devices 51 52 kubectl create -f devices_v1alpha1_devicemodel.yaml 53 kubectl create -f devices_v1alpha1_device.yaml 54 ``` 55 56 ### Create ClusterObjectSync and ObjectSync CRDs which are used in reliable message delivery. 57 58 ```shell 59 cd $GOPATH/src/github.com/kubeedge/kubeedge/build/crds/reliablesyncs 60 kubectl create -f cluster_objectsync_v1alpha1.yaml 61 kubectl create -f objectsync_v1alpha1.yaml 62 ``` 63 64 ### Copy cloudcore binary 65 66 At this point, cloudcore can be copied to a new directory. 67 68 Copy cloudcore binary 69 70 ```shell 71 # copy $GOPATH/src/github.com/kubeedge/kubeedge/_output/local/bin/cloudcore to `~/kubeedge/` 72 mkdir ~/kubeedge/ 73 cp cloudcore ~/kubeedge/ 74 ``` 75 76 **Note:** `~/kubeedge/` dir is an example, in the following examples we continue to use `~/kubeedge/` as the binary startup directory. You can move `cloudcore` or `edgecore` binary to anywhere. 77 78 79 ### (**Optional**) Run `admission` 80 81 This feature is still being evaluated, please read the docs in [install the admission webhook](../../build/admission/README.md) 82 83 ## Setup Edge Node (KubeEdge Worker Node) 84 85 ### Clone KubeEdge 86 87 Setup [$GOPATH ](https://github.com/golang/go/wiki/SettingGOPATH) to clone the KubeEdge repository in the `$GOPATH`. 88 89 ```shell 90 git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge 91 ``` 92 93 ### Compile Edgecore 94 95 ```shell 96 cd $GOPATH/src/github.com/kubeedge/kubeedge 97 make all WHAT=edgecore 98 ``` 99 100 KubeEdge can also be cross compiled to run on ARM based processors. 101 Please follow the instructions given below or click [Cross Compilation](cross-compilation.md) for detailed instructions. 102 103 ```shell 104 cd $GOPATH/src/github.com/kubeedge/kubeedge/edge 105 make cross_build 106 ``` 107 108 KubeEdge can also be compiled with a small binary size. Please follow the below steps to build a binary of lesser size: 109 110 ```shell 111 apt-get install upx-ucl 112 cd $GOPATH/src/github.com/kubeedge/kubeedge/edge 113 make edge_small_build 114 ``` 115 116 **Note:** If you are using the smaller version of the binary, it is compressed using upx, therefore the possible side effects of using upx compressed binaries like more RAM usage, 117 lower performance, whole code of program being loaded instead of it being on-demand, not allowing sharing of memory which may cause the code to be loaded to memory 118 more than once etc. are applicable here as well. 119 120 **Note:** If you don't want to compile, you may perform the next step 121 122 + Download KubeEdge from [Releases](https://github.com/kubeedge/kubeedge/releases) 123 124 Download `kubeedge-$VERSION-$OS-$ARCH.tar.gz` from above link. It would contain Edgecore and the configuration files. 125 126 ### Copy edgecore binary 127 128 Copy edgecore file in a new directory 129 130 ```shell 131 cp $GOPATH/src/github.com/kubeedge/kubeedge/_output/local/bin/edgecore ~/kubeedge/ 132 ```