# How to troubleshoot Kapp (WIP)
###### tags: `kapp`
> This note is capture various troubleshooting methods for kapp
## Checkout the cheatsheet
https://carvel.dev/kapp/docs/latest/cheatsheet/
## Non-code troubleshooting
### Diff Flags
#### --diff-changes
Kapp shows the actions it is going to take for each of the changed resources in the yaml supplied. Along with this, if you want to see what all has changed in the latest yaml, there is a very convenient flag : “-c” or --diff-changes. With this you can see exactly what has changed from previous version to current version, in a convenient color coded way.
#### --diff-ui-alpha
This flag starts a UI Server and publishes the dependency of each changed resource and in what order it will be applied.
Example: Deploy gatekeeper app:
kapp deploy -a app4 -f path-to-your..yaml --diff-ui-alpha
Target cluster 'https://127.0.0.1:58479' (nodes: minikube)
```
Changes
Namespace Name Kind Conds. Age Op Op st. Wait to Rs Ri
(cluster) configs.config.gatekeeper.sh CustomResourceDefinition - - create - reconcile - -
^ constraintpodstatuses.status.gatekeeper.sh CustomResourceDefinition - - create - reconcile - -
^ constrainttemplatepodstatuses.status.gatekeeper.sh CustomResourceDefinition - - create - reconcile - -
^ constrainttemplates.templates.gatekeeper.sh CustomResourceDefinition - - create - reconcile - -
^ gatekeeper-admin PodSecurityPolicy - - create - reconcile - -
^ gatekeeper-manager-role ClusterRole - - create - reconcile - -
^ gatekeeper-manager-rolebinding ClusterRoleBinding - - create - reconcile - -
^ gatekeeper-system Namespace - - create - reconcile - -
^ gatekeeper-validating-webhook-configuration ValidatingWebhookConfiguration - - create - reconcile - -
gatekeeper-system gatekeeper-admin ServiceAccount - - create - reconcile - -
^ gatekeeper-audit Deployment - - create - reconcile - -
^ gatekeeper-controller-manager Deployment - - create - reconcile - -
^ gatekeeper-controller-manager PodDisruptionBudget - - create - reconcile - -
^ gatekeeper-critical-pods ResourceQuota - - create - reconcile - -
^ gatekeeper-manager-role Role - - create - reconcile - -
^ gatekeeper-manager-rolebinding RoleBinding - - create - reconcile - -
^ gatekeeper-webhook-server-cert Secret - - create - reconcile - -
^ gatekeeper-webhook-service Service - - create - reconcile - -
```
```
Op: 18 create, 0 delete, 0 update, 0 noop
Wait to: 18 reconcile, 0 delete, 0 noop
Diff UI server: http://127.0.0.1:60863
```
Access the UI server on the URL mentioned in the output.Simple page with changeset is presented with dependency graph. Changes are sorted in order that they will be applied. They will be applied in parallel within their group. Each change lists other changes that it will wait for before being applied.
## Code debugging
#### Prerequisites
1. Kapp code is cloned and built on your machine
2. Connected to a kubernetes cluster (either minikube, kind or k8s cluster)
Kapp can be easily debugged by adding “Println” statements. However, for live debugging the following steps can be followed. IDE being used is GoLand:
1. In the GoLand Project select carvel-kapp.
2. Click on “Edit Configurations” in the “Select Run/Debug configuration”
3. 
4. 
5. This will open the dialogue box. Enter the following in the fields:
a. Name: go build github.com/k14s/kapp/cmd/kapp
b. Run On: Local Machine
c. Configuration Tab:
i. Run Kind: Directory
ii. Directory: Path to kapp source code.
1. eg: /Users/xxxxxxx/go/src/github.com/carvel-kapp/cmd/kapp
iii. Output Directory: can be blank
iv. Working Directory: Path to kapp source code.
1. eg: /Users/xxxxxxx/go/src/github.com/carvel-kapp
v. Environment: can be blank
vi. Go tool arguments: can be blank
vii. Program arguments: add the command you want to debug
1. eg: deploy -a app -f /Users/xxxxxxx/workspace/apps/app.yml -c
viii. Click Ok
6. 
7. Add your break points and you are ready to debug.