github.com/SamarSidharth/kpt@v0.0.0-20231122062228-c7d747ae3ace/site/reference/cli/live/apply/README.md (about)

     1  ---
     2  title: "`apply`"
     3  linkTitle: "apply"
     4  type: docs
     5  description: >
     6    Apply a package to the cluster (create, update, prune).
     7  ---
     8  
     9  <!--mdtogo:Short
    10      Apply a package to the cluster (create, update, prune).
    11  -->
    12  
    13  `apply` creates, updates and deletes resources in the cluster to make the remote
    14  cluster resources match the local package configuration.
    15  
    16  ### Synopsis
    17  
    18  <!--mdtogo:Long-->
    19  
    20  ```
    21  kpt live apply [PKG_PATH | -] [flags]
    22  ```
    23  
    24  #### Args
    25  
    26  ```
    27  PKG_PATH | -:
    28    Path to the local package which should be applied to the cluster. It must
    29    contain a Kptfile or a ResourceGroup manifest with inventory metadata.
    30    Defaults to the current working directory.
    31    Using '-' as the package path will cause kpt to read resources from stdin.
    32  ```
    33  
    34  #### Flags
    35  
    36  ```
    37  --dry-run:
    38    It true, kpt will validate the resources in the package and print which
    39    resources will be applied and which resources will be pruned, but no resources
    40    will be changed.
    41    If the --server-side flag is true, kpt will do a server-side dry-run, otherwise
    42    it will be a client-side dry-run. Note that the output will differ somewhat
    43    between the two alternatives.
    44  
    45  --field-manager:
    46    Identifier for the **owner** of the fields being applied. Only usable
    47    when --server-side flag is specified. Default value is kubectl.
    48  
    49  --force-conflicts:
    50    Force overwrite of field conflicts during apply due to different field
    51    managers. Only usable when --server-side flag is specified.
    52    Default value is false (error and failure when field managers conflict).
    53  
    54  --install-resource-group:
    55    Install the ResourceGroup CRD into the cluster if it isn't already
    56    available. Default is false.
    57  
    58  --inventory-policy:
    59    Determines how to handle overlaps between the package being currently applied
    60    and existing resources in the cluster. The available options are:
    61  
    62      * strict: If any of the resources already exist in the cluster, but doesn't
    63        belong to the current package, it is considered an error.
    64      * adopt: If a resource already exist in the cluster, but belongs to a
    65        different package, it is considered an error. Resources that doesn't belong
    66        to other packages are adopted into the current package.
    67  
    68    The default value is `strict`.
    69  
    70  --output:
    71    Determines the output format for the status information. Must be one of the following:
    72  
    73      * events: The output will be a list of the status events as they become available.
    74      * json: The output will be a list of the status events as they become available,
    75        each formatted as a json object.
    76      * table: The output will be presented as a table that will be updated inline
    77        as the status of resources become available.
    78  
    79    The default value is ‘events’.
    80  
    81  --prune-propagation-policy:
    82    The propagation policy that should be used when pruning resources. The
    83    default value here is 'Background'. The other options are 'Foreground' and 'Orphan'.
    84  
    85  --prune-timeout:
    86    The threshold for how long to wait for all pruned resources to be
    87    deleted before giving up. If this flag is not set, kpt live apply will wait
    88    until interrupted. In most cases, it would also make sense to set the
    89    --prune-propagation-policy to Foreground when this flag is set.
    90  
    91  --reconcile-timeout:
    92    The threshold for how long to wait for all resources to reconcile before
    93    giving up. If this flag is not set, kpt live apply will wait until
    94    interrupted.
    95  
    96  --server-side:
    97    Perform the apply operation server-side rather than client-side.
    98    Default value is false (client-side).
    99  
   100  --show-status-events:
   101    The output will include the details on the reconciliation status
   102    for all resources. Default is `false`.
   103  
   104    Does not apply for the `table` output format.
   105  ```
   106  
   107  <!--mdtogo-->
   108  
   109  ### Examples
   110  
   111  <!--mdtogo:Examples-->
   112  
   113  ```shell
   114  # apply resources in the current directory
   115  $ kpt live apply
   116  ```
   117  
   118  ```shell
   119  # apply resources in the my-dir directory and wait up until 15 minutes 
   120  # for all the resources to be reconciled before pruning
   121  $ kpt live apply --reconcile-timeout=15m my-dir
   122  ```
   123  
   124  ```shell
   125  # apply resources and specify how often to poll the cluster for resource status
   126  $ kpt live apply --reconcile-timeout=15m --poll-period=5s my-dir
   127  ```
   128  
   129  <!--mdtogo-->