sigs.k8s.io/cluster-api-provider-azure@v1.14.3/hack/debugging/Readme.md (about)

     1  # Debugging scripts
     2  Some helpful scripts for debugging various setups
     3  
     4  
     5  ## Kubectl plugins
     6  Any scripts that start with kubectl can be used as [kubectl plugins](https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/).  They can also be used directly as with any other script.
     7  
     8  To use as plugins, copy the files to a folder in your path such as:
     9  
    10  ```bash
    11  cp hack/debugging/kubectl-* /usr/local/bin
    12  ```
    13  
    14  To use as a script:
    15  
    16  ```bash
    17  ./hack/debugging/kubectl-capz-ssh
    18  ```
    19  
    20  ### capz-ssh
    21  Quickly ssh to a node to debug VM join issues.
    22  
    23  
    24  To connect to an Azure Machine:
    25  
    26  ```bash
    27  # find the azure cluster and azure machine you wish to ssh too
    28  $ kubectl get azuremachine
    29  NAME                                 READY   STATE
    30  capz-cluster-0-control-plane-5b5fc   true    Succeeded
    31  capz-cluster-0-control-plane-vg8pl   true    Succeeded
    32  capz-cluster-0-control-plane-z5pst   true    Succeeded
    33  capz-cluster-0-md-0-fljwt            true    Succeeded
    34  capz-cluster-0-md-0-wbx2r            true    Succeeded
    35  
    36  
    37  $ kubectl capz ssh -am capz-cluster-3-control-plane-rcmkh
    38  ```
    39  
    40  To connect to an instance of Azure Machine Pool, you can do the following:
    41  
    42  - If you don't know the instance name you can run the list command to get all
    43  instances of a Machine Pool
    44  
    45  ```bash
    46  $ ./hack/debugging/kubectl-capz-ssh  --list-azure-machine-pool  --azure-machine-pool machinepool-template-mp-0
    47  Utility tool to ssh'ing into CAPZ nodes
    48  
    49  Listing Azure Machine Pool machinepool-template-mp-0
    50  ID      ComputerName
    51  ========================================
    52  2       machinepool-template-mp-0000002
    53  3       machinepool-template-mp-0000003
    54  ```
    55  
    56  - Then you can connect to a node using the `ID`
    57  
    58  ```bash
    59  $ ./hack/debugging/kubectl-capz-ssh  --azure-machine-pool machinepool-template-mp-0 --azure-machine-pool-id 2
    60  ```
    61  
    62  ### capz-map
    63  There are many different CRDs required to deploy a machine (such as azmachine, capimachine, and kubeadm bootstrap).  View how all the configurations are mapped together:
    64  
    65  ```bash
    66  $ kubectl capz map
    67  AzureCluster: capz-cluster-0
    68  AzureMachine: capz-cluster-0-control-plane-5b5fc
    69  Machine: capz-cluster-0-control-plane-xhbjh
    70  Kubeadmconfig: capz-cluster-0-control-plane-g8gql
    71  ```