github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/proposals/keadm-scope.md (about)

     1  ---
     2  title: KubeEdge installer scope (Issue 324)
     3  status: implementable
     4  authors:
     5      - "@samy2019"
     6      - "@srivatsav123"
     7  approvers:
     8    - "@m1093782566"
     9    - "@rohitsardesai83"
    10    - "@sids-b"
    11  creation-date: 2019-04-11
    12  last-updated: 2019-05-20
    13  ---
    14  
    15  # Motivation
    16  
    17  Many users shared their feedback that kubeEdge installation is too complicated and it may prevent people from trying kubeEdge. There should a simplified way to have **Getting Started with KubeEdge**, so that user can concentrate more on using it instantly, rather than
    18  getting entangled in the installation steps.
    19  
    20  # Proposal
    21  
    22  KubeEdge shall have simple commands and steps to bring up both cloud and edge components.
    23  The user experience in **Getting Started with KubeEdge** will be seamless.
    24  Hence proposing the following commands for KubeEdge installation process.
    25  
    26  ## Inscope
    27  
    28  1. To support first set of basic commands (listed below) to bootstrap and teardown both KubeEdge cloud and edge (node) components in different VM's or hosts.
    29  
    30  For cloud, commands shall be:
    31  
    32  - `keadm init`
    33  - `keadm reset`
    34  
    35  For edge, commands shall be:
    36  
    37  - `keadm join`
    38  - `keadm reset`
    39  
    40  **NOTE:**
    41  `node` key is used for edge component in the command, for superficial reasons. Because `kubeedge edge init` had `edge` used twice and didn't sound nice.
    42  
    43  2. To support download and installation of pre-requisites for KubeEdge cloud and edge components.
    44  
    45  ## Out of scope
    46  
    47  1. To support failures reported while execution of pre-requisites while execution of KubeEdge commands.
    48  2. To support display of KubeEdge version.
    49  
    50  # Scope of commands
    51  
    52  ## Design of the commands
    53  
    54  **NOTE**: All the below steps are executed as root user, to execute as sudo user. Please add `sudo` infront of all the commands.
    55  
    56  ### kubeedge --help or kubeedge
    57  
    58  ```
    59      ┌──────────────────────────────────────────────────────────┐
    60      │ KEADM                                                    │
    61      │ Easily bootstrap a KubeEdge cluster                      │
    62      │                                                          │
    63      │ Please give us feedback at:                              │
    64      │ https://github.com/kubeedge/kubeedge/issues              │
    65      └──────────────────────────────────────────────────────────┘
    66  	
    67      Create a two-machine cluster with one cloud node
    68      (which controls the edge node cluster), and one edge node
    69      (where native containerized application, in the form of
    70      pods and deployments run), connects to devices.
    71  
    72  Usage:
    73    kubeedge [command]
    74  
    75  Examples:
    76  
    77      ┌──────────────────────────────────────────────────────────┐
    78      │ On the first machine:                                    │
    79      ├──────────────────────────────────────────────────────────┤
    80      │ master node (on the cloud)#  keadm init <options>        │
    81      └──────────────────────────────────────────────────────────┘
    82  
    83      ┌──────────────────────────────────────────────────────────┐
    84      │ On the second machine:                                   │
    85      ├──────────────────────────────────────────────────────────┤
    86      │ worker node (at the edge)#  keadm join <options>         │
    87      └──────────────────────────────────────────────────────────┘
    88  
    89      You can then repeat the second step on as many other machines as you like.
    90  
    91  
    92  Available Commands:
    93    help        Help about any command
    94    init        Bootstraps cloud component. Checks and install (if required) the pre-requisites.
    95    join        Bootstraps edge component. Checks and install (if required) the pre-requisites.
    96                Execute it on any edge node machine you wish to join
    97    reset       Teardowns KubeEdge (cloud & edge) component
    98  
    99  Flags:
   100    -h, --help   help for kubeedge
   101  
   102  Use "kubeedge [command] --help" for more information about a command.
   103  ```
   104  
   105  ### keadm init --help
   106  
   107  ```
   108  keadm init command bootstraps KubeEdge's cloud component.
   109  It checks if the pre-requisites are installed already,
   110  if not installed, this command will help in download,
   111  installation and execution on the host.
   112  
   113  Usage:
   114    keadm init [flags]
   115  
   116  Examples:
   117  
   118  keadm init
   119  
   120  
   121  Flags:
   122        --docker-version string[="18.06.0"]          Use this key to download and use the required Docker version (default "18.06.0")
   123    -h, --help                                       help for init
   124        --kubeedge-version string[="0.3.0-beta.0"]   Use this key to download and use the required KubeEdge version (default "0.3.0-beta.0")
   125        --kubernetes-version string[="1.14.1"]       Use this key to download and use the required Kubernetes version (default "1.14.1")
   126  
   127  ```
   128  
   129  ### keadm reset --help
   130  
   131  ```
   132  keadm reset command can be executed in both cloud and edge node
   133  In cloud node it shuts down the cloud processes of KubeEdge
   134  In edge node it shuts down the edge processes of KubeEdge
   135  
   136  Usage:
   137  keadm reset [flags]
   138  
   139  Examples:
   140  
   141  For cloud node:
   142  keadm reset
   143  
   144  For edge node:
   145  keadm reset --k8sserverip 10.20.30.40:8080
   146  
   147  
   148  Flags:
   149    -h, --help                 help for reset
   150    -k, --k8sserverip string   IP:Port address of cloud components host/VM
   151    
   152  ```
   153  
   154  ### keadm join --help
   155  
   156  ```
   157  
   158  "keadm join" command bootstraps KubeEdge's edge component.
   159  It checks if the pre-requisites are installed already,
   160  If not installed, this command will help in download,
   161  install and execute on the host.
   162  It will also connect with cloud component to receieve 
   163  further instructions and forward telemetry data from 
   164  devices to cloud
   165  
   166  Usage:
   167    keadm join [flags]
   168  
   169  Examples:
   170  
   171  keadm join --cloudcoreip=<ip address> --edgenodeid=<unique string as edge identifier>
   172  
   173    - For this command --cloudcoreip flag is a Mandatory flag
   174    - This command will download and install the default version of pre-requisites and KubeEdge
   175  
   176  keadm join --cloudcoreip=10.20.30.40 --edgenodeid=testing123 --kubeedge-version=0.2.1 --k8sserverip=50.60.70.80:8080
   177  
   178    - In case, any option is used in a format like as shown for "--docker-version" or "--docker-version=", without a value
   179      then default values will be used.
   180      Also options like "--docker-version", and "--kubeedge-version", version should be in
   181      format like "18.06.3" and "0.2.1".
   182  
   183  
   184  Flags:
   185        --docker-version string[="18.06.0"]          Use this key to download and use the required Docker version (default "18.06.0")
   186    -e, --cloudcoreip string                         IP address of KubeEdge CloudCore
   187    -i, --edgenodeid string                          KubeEdge Node unique identification string, If flag not used then the command will generate a unique id on its own
   188    -h, --help                                       help for join
   189    -k, --k8sserverip string                         IP:Port address of K8S API-Server
   190        --kubeedge-version string[="0.3.0-beta.0"]   Use this key to download and use the required KubeEdge version (default "0.3.0-beta.0")
   191  
   192  ```
   193  
   194  ## Explaining the commands
   195  
   196  ### Master Node (on the Cloud) commands
   197  
   198  `keadm init`
   199    - What is it?
   200       * This command will be responsible to bring up KubeEdge cloud components like edge-controller and K8S (using kubeadm)
   201     
   202    - What shall be its scope ?
   203      1. Check version of OS and install subsequently the required pre-requisites using supported steps. Currently we will support **ONLY** (Ubuntu & CentOS)
   204      2. Check and install all the pre-requisites before executing edge-controller, which are
   205          * docker (currently 18.06.0ce3-0~ubuntu) and check if service is up
   206          * kubelet, kubeadm & kubectl (latest version)
   207          * openssl (latest available in OS repos)
   208      3. Generate certificates using openssl and save the certs in a predefined static path.
   209      It will also compress the folder and display on the terminal so that user can pick it up and transfer it to edge node (VM/host) manually.
   210      4. It will update the certificate information in `controller.yaml`
   211      5. Start `keadm init`.
   212  
   213         **NOTE:** Issues encountered while performing kubeadm init need to be resolved by the user
   214      6. Update `/etc/kubernetes/manifests/kube-apiserver.yaml` with below information
   215      ```
   216      - --insecure-port=8080
   217      - --insecure-bind-address=0.0.0.0
   218      ```
   219  
   220      7. start edge-controller
   221  
   222  `keadm reset`
   223    - What is it? 
   224      * This command will be responsible to bring down KubeEdge cloud components edge-controller and call `kubeadm reset` (to stop K8S)
   225  
   226    - What shall be its scope ?
   227      1. It shall get the nodes and execute `kubectl drain --force`.
   228      2. Kill `edge-controller` process
   229      3. Execute `kubeadm reset`
   230  
   231  ### Worker Node (at the Edge) commands
   232  
   233  `keadm join`
   234    - What is it? 
   235      * This command will be responsible to install pre-requisites and make modifications needed for KubeEdge edge component (edgecore) and start it
   236  
   237    - What shall be its scope ?
   238  
   239      1. Check version of OS and install subsequently the required pre-requisites using supported steps. Currently we will support **ONLY** (Ubuntu & CentOS)
   240      2. Check and install all the pre-requisites before executing edge-controller, which are
   241          * Docker (currently 18.06.0ce3-0~ubuntu) and check is service is up.
   242          * mosquitto (latest available in OS repos) and check if running.
   243      3. This command will take `--certPath` (string type) as mandatory option which shall be the certificates path; wherein the certs were transfered from cloud node and uncompressed. It will modify `$GOPATH/src/github.com/kubeedge/kubeedge/edge/conf/edge.yaml` file against `edgehub.websocket.certfile` and `edgehub.websocket.keyfile` fields.
   244      4. Create `$GOPATH/src/github.com/kubeedge/kubeedge/build/node.json` and apply it using `curl` command to api-server
   245      5. This command will take mandatory `-e` or `--cloudcoreip` flag to specify the address of Kubeedge cloudcore
   246      6. Create `$GOPATH/src/github.com/kubeedge/kubeedge/edge/conf/edge.yaml`
   247          * Use `--cloudcoreip` flag to update the `websocket.url` field.
   248          * Use `--edgenodeid` flags value to update `controller.node-id`,`edged.hostname-override` field.
   249      7. Register or add node to K8S cluster, Using Flag `-k` or `--k8sserverip` value to connect with the api-server. 
   250          * Create `node.json` file and update it with `-i` or `--edgenodeid` flags value in `metadata.name` field.
   251          * Apply it using `curl` command to api-server
   252  
   253      8. start edgecore
   254  
   255  `keadm reset`
   256  
   257    - What is it?
   258      * This command will be responsible to bring down KubeEdge edge component (edgecore)
   259  
   260    - What it will do?
   261  
   262      1. Remove node using `curl` command from K8S cluster
   263      2. Kill `edgecore` process