github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/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  --poll-period:
    82    The frequency with which the cluster will be polled to determine
    83    the status of the applied resources. The default value is 2 seconds.
    84  
    85  --prune-propagation-policy:
    86    The propagation policy that should be used when pruning resources. The
    87    default value here is 'Background'. The other options are 'Foreground' and 'Orphan'.
    88  
    89  --prune-timeout:
    90    The threshold for how long to wait for all pruned resources to be
    91    deleted before giving up. If this flag is not set, kpt live apply will wait
    92    until interrupted. In most cases, it would also make sense to set the
    93    --prune-propagation-policy to Foreground when this flag is set.
    94  
    95  --reconcile-timeout:
    96    The threshold for how long to wait for all resources to reconcile before
    97    giving up. If this flag is not set, kpt live apply will wait until
    98    interrupted.
    99  
   100  --server-side:
   101    Perform the apply operation server-side rather than client-side.
   102    Default value is false (client-side).
   103  
   104  --show-status-events:
   105    The output will include the details on the reconciliation status
   106    for all resources. Default is `false`.
   107  
   108    Does not apply for the `table` output format.
   109  ```
   110  
   111  <!--mdtogo-->
   112  
   113  ### Examples
   114  
   115  <!--mdtogo:Examples-->
   116  
   117  ```shell
   118  # apply resources in the current directory
   119  $ kpt live apply
   120  ```
   121  
   122  ```shell
   123  # apply resources in the my-dir directory and wait up until 15 minutes 
   124  # for all the resources to be reconciled before pruning
   125  $ kpt live apply --reconcile-timeout=15m my-dir
   126  ```
   127  
   128  ```shell
   129  # apply resources and specify how often to poll the cluster for resource status
   130  $ kpt live apply --reconcile-timeout=15m --poll-period=5s my-dir
   131  ```
   132  
   133  <!--mdtogo-->