github.com/stakater/IngressMonitorController@v1.0.103/docs/Deploying-to-Kubernetes.md (about)

     1  # Deploying to Kubernetes
     2  
     3  Ingress Monitor Controller can be used to watch ingresses in a specific namespace, or all namespaces. By default the
     4   controller watches in all namespaces. To use Ingress Monitor Controller for a specific namespace, the relevant
     5   instructions where indicated should be followed.  
     6  
     7  ### Supported Kubernetes versions
     8  
     9  Ingress Monitor Controller has been tested with Kubernetes version 1.8.x and 1.10.x, and should work with higher versions.
    10  
    11  ### Enabling
    12  
    13  By default, the controller ignores the ingresses without a specific annotation on it. You will need to add the following annotation on your ingresses so that the controller is able to recognize and monitor the ingresses.
    14  
    15  ```yaml
    16  "monitor.stakater.com/enabled": "true"
    17  ```
    18  
    19  The annotation key is `monitor.stakater.com/enabled` and you can toggle the value of this annotation between `true` and `false` to enable or disable monitoring of that specific ingress.
    20  
    21  ### Configuration
    22  
    23  Following are the available options that you can use to customize the controller:
    24  
    25  | Key                   |Description                                                                    |
    26  |-----------------------|-------------------------------------------------------------------------------|
    27  | providers             | An array of uptime providers that you want to add to your controller          |
    28  | secrets               | An array of secrets that you want to mount to your controller                 |
    29  | enableMonitorDeletion | A safeguard flag that is used to enable or disable monitor deletion on ingress deletion (Useful for prod environments where you don't want to remove monitor on ingress deletion) |
    30  | resyncPeriod          | Resync period in seconds, allows to re-sync periodically the monitors with the Ingresses. Defaults to 0 (= disabled) |
    31  | watchNamespace        | Name of the namespace if you want to monitor ingresses only in that namespace. Defaults to null |
    32  | mount                 | `"secret"` or `"configMap"`. How to pass user credentials, API keys etc.          |  
    33  
    34  For the list of providers, there are a number of options that you need to specify. The table below lists them:
    35  
    36  | Key           | Description                                                               |
    37  |---------------|---------------------------------------------------------------------------|
    38  | name          | Name of the provider (From the list of supported uptime checkers)         |
    39  | apiKey        | ApiKey of the provider                                                    |
    40  | apiURL        | Base url of the ApiProvider                                               |
    41  | alertContacts | A `-` separated list of contact id's that you want to add to the monitors |
    42  
    43  #### Uptime Checker specific
    44  ##### UptimeRobot ([https://uptimerobot.com](https://uptimerobot.com))
    45  Follow the [UptimeRobot Configuration guide](uptimerobot-configuration.md) to see how to fetch `alertContacts` from UptimeRobot.
    46  
    47  ##### Pingdom ([https://pingdom.com](https://pingdom.com))
    48  [Pingdom Configuration guide](../docs/pingdom-configuration.md)
    49  
    50  ##### Statuscake ([https://www.statuscake.com](https://www.statuscake.com))
    51  [Statuscake Configuration guide](../docs/statuscake-configuration.md)
    52  
    53  #### Configuring through ingress annotations
    54  
    55  The following optional annotations allow you to set further configuration:
    56  
    57  | Annotation                            | Description                                                                                                                 |
    58  |---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
    59  | `"monitor.stakater.com/forceHttps"`   | If set to the string `"true"`, the monitor endpoint will use HTTPS, even if the Ingress manifest itself doesn't specify TLS |
    60  | `"monitor.stakater.com/overridePath"` | Set this annotation to define the healthcheck path for this monitor, overriding the controller's default logic              |
    61  | `"monitor.stakater.com/name"`         | Set this annotation to define the Monitor friendly name in Uptime Robot. If unset, defaults to the template in the config   |
    62  
    63  ### Vanilla Manifests
    64  
    65  The Ingress Monitor Controller can be deployed with vanilla manifests or Helm Charts. For Vanilla manifests, download the
    66   [ingressmonitorcontroller.yaml](https://github.com/stakater/IngressMonitorController/blob/master/deployments/kubernetes/ingressmonitorcontroller.yaml) file.
    67  
    68  #### Configuring
    69  
    70  The configuration discussed in the above section needs to be done by modifying `config.yaml` data for the ConfigMap resource in the `ingressmonitorcontroller.yaml` file.
    71  
    72  ##### Using Secrets
    73  
    74  To pass user credentials/ API keys in secrets:
    75      
    76    1. Open [values.yaml](https://github.com/stakater/IngressMonitorController/blob/master/deployments/kubernetes/chart/ingressmonitorcontroller/values.yaml) file by navigating to `deployments/kubernetes/chart/ingressmonitorcontroller/`
    77    
    78    2. Set `mount` equals to `"secret"` and pass the data in the data section at the bottom.
    79    
    80    3. Run `helm template . > file_to_generate.yaml`
    81    
    82    4. Deploy using the `Deploying` section below.
    83  
    84  To use existing Secrets:
    85  
    86    1. Open [values.yaml](https://github.com/stakater/IngressMonitorController/blob/master/deployments/kubernetes/chart/ingressmonitorcontroller/values.yaml) file by navigating to `deployments/kubernetes/chart/ingressmonitorcontroller/`
    87  
    88    2. Set `mount` equals to `"secret"` and pass the data in the data section at the bottom.
    89  
    90    3. Set `existingSecret` to `EXISTING_SECRET_NAME`
    91  
    92  
    93  ##### Using ConfigMap
    94  
    95  To pass user credentials/ API keys in secrets:
    96       
    97    1. Open [values.yaml](https://github.com/stakater/IngressMonitorController/blob/master/deployments/kubernetes/chart/ingressmonitorcontroller/values.yaml) file by navigating to `deployments/kubernetes/chart/ingressmonitorcontroller/`
    98    
    99    2. Set `mount` equals to `"configMap"` and pass the data in the data section at the bottom.
   100    
   101    3. Run `helm template . > file_to_generate.yaml`
   102    
   103    4. Deploy using the `Deploying` section below.
   104  
   105  ##### Running for a single namespace
   106  
   107  Add environment variable `KUBERNETES_NAMESPACE` in `ingressmonitorcontroller.yaml` for the Deployment resource and set its value
   108   to the namespace you want to watch in. After that, apply the `ingressmonitorcontroller.yaml` manifest in any namespace.
   109    The deployed controller will now watch only that namespace.
   110  
   111  #### Deploying
   112  
   113  You can deploy the controller in the namespace you want to monitor by running the following kubectl command:
   114  
   115  ```bash
   116  kubectl apply -f ingressmonitorcontroller.yaml -n <namespace>
   117  ```
   118  
   119  *Note*: Before applying `ingressmonitorcontroller.yaml`, You need to modify the namespace in the `RoleBinding` subjects section to the namespace you want to apply RBAC to.
   120  
   121  ### Helm Charts
   122  
   123  The Ingress Monitor Controller can be deployed with Helm Charts or vanilla manifests. For Helm Charts follow the below steps:
   124  
   125  1. Add the chart repo:
   126  
   127     i. `helm repo add stakater https://stakater.github.io/stakater-charts/`
   128  
   129     ii. `helm repo update`
   130  2. Set configuration as discussed in the Configuration section
   131  
   132     i. `helm fetch --untar stakater/ingressmonitorcontroller`
   133  
   134     ii. Open and edit `ingressmonitorcontroller/values.yaml` in a text editor
   135  3. Install the chart
   136     * `helm install stakater/ingressmonitorcontroller -f ingressmonitorcontroller/values.yaml -n ingressmonitorcontroller`
   137  
   138  ##### Running for a single namespace
   139  
   140  Set `watchNamespace` to `<namespace-name>` in `ingressmonitorcontroller/values.yaml` before applying the helm chart
   141   and the controller will then watch in that namespace.
   142  
   143  ## Bug Reports & Feature Requests
   144  
   145  Please use the [issue tracker](https://github.com/stakater/IngressMonitorController/issues) to report any bugs or file feature requests.
   146  
   147  ## Changelog
   148  
   149  View our closed [Pull Requests](https://github.com/stakater/IngressMonitorController/pulls?q=is%3Apr+is%3Aclosed).