github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/site/book/06-deploying-packages/01-initializing-a-package-for-apply.md (about)

     1  Before you can apply the package to the cluster, it needs to be initialized
     2  using `live init`. This is a one-time client-side operation that adds metadata
     3  to the `ResourceGroup` CR (by default located in `resourcegroup.yaml` file)
     4  specifying the name, namespace and inventoryID of the `ResourceGroup` resource
     5  `live apply` command will use to store the inventory (list of the resources applied).
     6  
     7  Let's initialize the `wordpress` package:
     8  
     9  ```shell
    10  $ kpt live init wordpress
    11  initializing "resourcegroup.yaml" inventory info (namespace: default)...success
    12  ```
    13  
    14  This creates the `ResourceGroup` CR in the `resourcegroup.yaml` file:
    15  
    16  ```yaml
    17  apiVersion: kpt.dev/v1alpha1
    18  kind: ResourceGroup
    19  metadata:
    20    name: inventory-74096247
    21    namespace: default
    22    labels:
    23      cli-utils.sigs.k8s.io/inventory-id: 0a32e2c0200b4bd4c19cd3e097086b4648b8902d-1653113657067255815
    24  ```
    25  
    26  `ResourceGroup` is a namespace-scoped resource. By default, `live init` command
    27  uses heuristics to automatically choose the namespace. In this example, all the
    28  resources in `wordpress` package were in the `default` namespace, so it chose
    29  `default` for the namespace. Alternatively, you can manually configure the name
    30  and namespace of the `ResourceGroup` resource.
    31  
    32  ?> Refer to the [init command reference][init-doc] for usage.
    33  
    34  !> Once a package is applied to the cluster, you do not want to change the
    35  `ResourceGroup` CR; doing so severs the association between the
    36  package and the inventory in the cluster, leading to destructive operations.
    37  
    38  [init-doc]: /reference/cli/live/init/