github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/setup/kubeedge_install_keadm.md (about)

     1  # Setup from KubeEdge Installer
     2  
     3  Keadm is used to install the cloud and edge components of kubeedge. It is not responsible for installing K8s and runtime, 
     4  so users must install a k8s master on cloud and runtime on edge first. Or use an existing cluster.
     5  
     6  Please refer [kubernetes-compatibility](https://github.com/kubeedge/kubeedge#kubernetes-compatibility) to get **Kubernetes compatibility** and determine what version of Kubernetes would be installed.
     7  
     8  Kubeedge interacts with the standard K8s API, so the K8s cluster can be installed with any tools, such as:
     9  - [Creating kubernetes cluster with kubeadm](<https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/>)
    10  - [Creating kubernetes cluster with minikube](<https://kubernetes.io/docs/setup/learning-environment/minikube/>)
    11  - [Creating kubernetes cluster with kind](<https://kubernetes.io/docs/setup/learning-environment/kind/>)
    12  
    13  ## Limitation
    14  
    15  - Currently support of `keadm` is available for Ubuntu and CentOS OS. RaspberryPi supports is in-progress.
    16  
    17  ## Getting KubeEdge Installer
    18  
    19  There are currently two ways to get keadm
    20  
    21  - Download from [KubeEdge Release](<https://github.com/kubeedge/kubeedge/releases>)
    22  
    23    1. Go to [KubeEdge Release](<https://github.com/kubeedge/kubeedge/releases>) page and download `keadm-$VERSION-$OS-$ARCH.tar.gz.`.
    24    2. Untar it at desired location, by executing `tar -xvzf keadm-$VERSION-$OS-$ARCH.tar.gz`.
    25    3. kubeedge folder is created after execution the command.
    26  
    27  - Building from source
    28  
    29    1. Download the source code.
    30    
    31        ```shell
    32        git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
    33        cd $GOPATH/src/github.com/kubeedge/kubeedge
    34        make all WHAT=keadm
    35        ```
    36  
    37        or
    38  
    39        ```shell
    40        go get github.com/kubeedge/kubeedge/keadm/cmd/keadm
    41        ```
    42  
    43    2.  If you used `go get`, the `keadm` binary is available in `$GOPATH/bin/`
    44        
    45        If you compiled from source, the `keadm` binary is in `$GOPATH/src/github.com/kubeedge/kubeedge/_output/local/bin/`
    46  
    47  ## Setup Cloud Side (KubeEdge Master Node)
    48  
    49  By default port '10000' in your cloudcore needs to be accessible for your edge nodes.
    50  
    51  `keadm init` will install cloudcore, generate the certs and install the CRDs. It also provide flag by which specific versions can be set.
    52  
    53  1. Execute `keadm init` : keadm needs super user rights (or root rights) to run successfully.
    54  
    55      Command flags
    56      The optional flags with this command are mentioned below
    57  
    58      ```shell
    59      "keadm init" command install KubeEdge's master node (on the cloud) component.
    60      It checks if the Kubernetes Master are installed already,
    61      If not installed, please install the Kubernetes first.
    62      
    63      Usage:
    64        keadm init [flags]
    65      
    66      Examples:
    67      
    68      keadm init
    69      
    70      - This command will download and install the default version of KubeEdge cloud component
    71      
    72      keadm init --kubeedge-version=1.2.0  --kube-config=/root/.kube/config
    73      
    74        - kube-config is the absolute path of kubeconfig which used to secure connectivity between cloudcore and kube-apiserver
    75      
    76      
    77      Flags:
    78        -h, --help                                help for init
    79            --kube-config string                  Use this key to set kube-config path, eg: $HOME/.kube/config (default "/root/.kube/config")
    80            --kubeedge-version string[="1.2.0"]   Use this key to download and use the required KubeEdge version (default "1.2.0")
    81            --master string                       Use this key to set K8s master address, eg: http://127.0.0.1:8080
    82      ```
    83  
    84  **IMPORTANT NOTE:** At least one of kubeconfig or master must be configured correctly, so that it can be used to verify the version and other info of the k8s cluster.
    85  
    86  Examples:
    87  
    88   ```shell
    89    keadm init
    90   ```
    91  
    92  Sample execution output:
    93  ```
    94  Kubernetes version verification passed, KubeEdge installation will start...
    95  ...
    96  KubeEdge cloudcore is running, For logs visit:  /var/log/kubeedge/cloudcore.log
    97  ```  
    98  
    99  ## Manually copy certs.tgz from cloud host to edge host(s)
   100  
   101  Now users still need to copy the certs to the edge nodes. In the future, it will support the use of tokens for authentication.
   102  
   103  On edge host
   104  
   105  ```
   106  mkdir -p /etc/kubeedge
   107  ```
   108  
   109  On cloud host
   110  
   111  ```
   112  cd /etc/kubeedge/
   113  scp -r certs.tgz username@ipEdgevm:/etc/kubeedge
   114  ```
   115  
   116  On edge host untar the certs.tgz file
   117  
   118  ```
   119  cd /etc/kubeedge
   120  tar -xvzf certs.tgz
   121  ```
   122  
   123  
   124  ## Setup Edge Side (KubeEdge Worker Node)
   125  
   126  `keadm join` will install edgecore and mqtt. It also provide flag by which specific versions can be set.
   127  
   128  Execute `keadm join <flags>`
   129  
   130   Command flags
   131  
   132    The optional flags with this command are shown in below shell
   133  
   134    ```shell
   135    "keadm join" command bootstraps KubeEdge's worker node (at the edge) component.
   136    It will also connect with cloud component to receive 
   137    further instructions and forward telemetry data from 
   138    devices to cloud
   139    
   140    Usage:
   141      keadm join [flags]
   142    
   143    Examples:
   144    
   145    keadm join --cloudcore-ipport=<ip:port address> --edgenode-name=<unique string as edge identifier>
   146    
   147      - For this command --cloudcore-ipport flag is a required option
   148      - This command will download and install the default version of pre-requisites and KubeEdge
   149    
   150    keadm join --cloudcore-ipport=10.20.30.40:10000 --edgenode-name=testing123 --kubeedge-version=1.2.0
   151    
   152    
   153    Flags:
   154          --certPath string                     The certPath used by edgecore, the default value is /etc/kubeedge/certs (default "/etc/kubeedge/certs")
   155      -e, --cloudcore-ipport string             IP:Port address of KubeEdge CloudCore
   156      -i, --edgenode-name string                KubeEdge Node unique identification string, If flag not used then the command will generate a unique id on its own
   157      -h, --help                                help for join
   158          --interfacename string                KubeEdge Node interface name string, the default value is eth0
   159          --kubeedge-version string[="1.2.0"]   Use this key to download and use the required KubeEdge version (default "1.2.0")
   160      -r, --runtimetype string                  Container runtime type
   161    ```
   162  
   163  **IMPORTANT NOTE:** 
   164  1. For this command --cloudcore-ipport flag is a Mandatory flag
   165  1. The KubeEdge version used in cloud and edge side should be same. 
   166  
   167   Examples:
   168  
   169   ```shell
   170    keadm join --cloudcore-ipport=192.168.20.50:10000
   171   ```
   172  
   173  Sample execution output:
   174  
   175  ```shell
   176  Host has mosquit+ already installed and running. Hence skipping the installation steps !!!
   177  ...
   178  KubeEdge edgecore is running, For logs visit:  /var/log/kubeedge/edgecore.log
   179  ```
   180  
   181  ## Reset KubeEdge Master and Worker nodes
   182  
   183  `keadm reset` will stop KubeEdge components. It doesn't uninstall/remove any of the pre-requisites.
   184  
   185  Execute `keadm reset`
   186  
   187  Command flags
   188  
   189  ```shell
   190  keadm reset --help
   191  
   192  keadm reset command can be executed in both cloud and edge node
   193  In cloud node it shuts down the cloud processes of KubeEdge
   194  In edge node it shuts down the edge processes of KubeEdge
   195  
   196  Usage:
   197    keadm reset [flags]
   198  
   199  Examples:
   200  
   201  For cloud node:
   202  keadm reset
   203  
   204  For edge node:
   205  keadm reset
   206  
   207  
   208  Flags:
   209    -h, --help   help for reset
   210  ```
   211  
   212  ## Errata
   213  
   214  1. Error in CloudCore
   215  
   216      If you are getting the below error in Cloudcore.log
   217  
   218      ```shell
   219      E1231 04:37:27.397431   19607 reflector.go:125] github.com/kubeedge/kubeedge/cloud/pkg/devicecontroller/manager/device.go:40: Failed to list *v1alpha1.Device: the server could not find the requested resource (get devices.devices.kubeedge.io)
   220      E1231 04:37:27.398273   19607 reflector.go:125] github.com/kubeedge/kubeedge/cloud/pkg/devicecontroller/manager/devicemodel.go:40: Failed to list *v1alpha1.DeviceModel: the server could not find the requested resource (get devicemodels.devices.kubeedge.io)
   221      ```
   222  
   223      browse to the
   224  
   225      ```shell
   226      cd $GOPATH/src/github.com/kubeedge/kubeedge/build/crds/devices
   227      ```
   228  
   229      and apply the below
   230  
   231      ```shell
   232        kubectl create -f devices_v1alpha1_devicemodel.yaml
   233        kubectl create -f devices_v1alpha1_device.yaml
   234      ```
   235  
   236      or
   237  
   238      ```shell
   239       kubectl create -f https://raw.githubusercontent.com/kubeedge/kubeedge/<kubeEdge Version>/build/crds/devices/devices_v1alpha1_device.yaml
   240       kubectl create -f https://raw.githubusercontent.com/kubeedge/kubeedge/<kubeEdge Version>/build/crds/devices/devices_v1alpha1_devicemodel.yaml
   241      ```
   242     
   243      Also, create ClusterObjectSync and ObjectSync CRDs which are used in reliable message delivery.
   244  
   245      ```shell
   246       cd $GOPATH/src/github.com/kubeedge/kubeedge/build/crds/reliablesyncs
   247       kubectl create -f cluster_objectsync_v1alpha1.yaml
   248       kubectl create -f objectsync_v1alpha1.yaml
   249      ```