From 3318182ad1698e1e30e610ce717825a821c3fb19 Mon Sep 17 00:00:00 2001 From: sakshisharma84 Date: Fri, 31 May 2024 17:05:58 -0400 Subject: [PATCH 1/5] [BOP-643] Installation script (#19) --- content/docs/setup/README.md | 75 +++++++++++++++++++++ content/docs/setup/install.sh | 122 ++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100755 content/docs/setup/install.sh diff --git a/content/docs/setup/README.md b/content/docs/setup/README.md index 60920c7f..95986054 100644 --- a/content/docs/setup/README.md +++ b/content/docs/setup/README.md @@ -8,3 +8,78 @@ However, as of commit `e19af33`, it still requires the following tools to be ins - `kubectl` of version `1.29.0` or above ([download](https://kubernetes.io/docs/tasks/tools/#kubectl)) - `k0sctl` of version `0.17.0` or above ([download](https://github.com/k0sproject/k0sctl/releases)) + +# Installation via script + +You can use the [installation script](./install.sh) to install the following dependencies. +- mkectl (default version: v4.0.0-alpha.0.3) +- k0sctl (default version: 0.17.8) +- kubectl (default version: v1.30.0) + +To override the default versions, you can pass the variables `K0SCTL_VERSION`,`MKECTL_VERSION`and `KUBECTL_VERSION`. + +> P.S. The script detects if kubectl is already installed in the system. If so, it will not overwrite it. + +### Usage + +1. Install the dependencies using the following command. + + ```shell + sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Mirantis/mke-docs/main/content/docs/setup/install.sh)" + ``` + +2. The script is designed to detect the os and the underlying architecture. Based on this, it shall install the appropriate binaries `k0sctl`, `kubectl` and `mkectl` in `/usr/local/bin`. + > Note: Make sure /usr/local/bin is in your PATH environment variable. + +3. Confirm successful installations by running + + a. _mkectl version command_ + + ```shell + mkectl version + ``` + Output: + ```shell + Version: v4.0.0-alpha.0.3 + ``` + b. _k0sctl version command_ + ```shell + k0sctl version + ``` + Output: + ```shell + version: v0.17.8 + commit: b061291 + ``` + c. _kubectl version command_ + ```shell + kubectl version + ``` + Output: + ```shell + Client Version: v1.30.0 + Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 + Server Version: v1.29.3+k0s + ``` + +### Debug mode +To turn the debug mode on, run +```shell +sudo DEBUG=true /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/Mirantis/mke-docs/main/content/docs/setup/install.sh)" +``` + +### Install different version +To install non-default versions of mkectl, kubectl and k0sctl, you can use `MKECTL_VERSION`, `KUBECTL_VERSION` and `K0SCTL_VERSION` respectively. + +Example usage: +```shell +sudo K0SCTL_VERSION=0.17.4 /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/Mirantis/mke-docs/main/content/docs/setup/install.sh)" +``` + +This shall install k0sctl version 0.17.4. +```shell +k0sctl version + +version: v0.17.4 +commit: 372a589 +``` diff --git a/content/docs/setup/install.sh b/content/docs/setup/install.sh new file mode 100755 index 00000000..9148be84 --- /dev/null +++ b/content/docs/setup/install.sh @@ -0,0 +1,122 @@ +#!/bin/sh +set -e + +PATH=$PATH:/usr/local/bin + +if [ -n "${DEBUG}" ]; then + set -x +fi + +detect_uname() { + os="$(uname)" + case "$os" in + Linux) echo "linux" ;; + Darwin) echo "darwin" ;; + *) echo "Unsupported operating system: $os" 1>&2; return 1 ;; + esac + unset os +} + +detect_arch() { + arch="$(uname -m)" + case "$arch" in + amd64|x86_64) echo "x64" ;; + arm64|aarch64) echo "arm64" ;; + armv7l|armv8l|arm) echo "arm" ;; + *) echo "Unsupported processor architecture: $arch" 1>&2; return 1 ;; + esac + unset arch +} + +# download_k0sctl_url() fetches the k0sctl download url. +download_k0sctl_url() { + echo "https://github.com/k0sproject/k0sctl/releases/download/v$K0SCTL_VERSION/k0sctl-$uname-$arch" +} + +# download_kubectl_url() fetches the kubectl download url. +download_kubectl_url() { + if [ "$arch" = "x64" ]; + then + arch=amd64 + fi + echo "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${uname}/${arch}/kubectl" +} + +install_kubectl() { + if [ -z "${KUBECTL_VERSION}" ]; then + echo "Using default kubectl version v1.30.0" + KUBECTL_VERSION=v1.30.0 + fi + kubectlDownloadUrl="$(download_kubectl_url)" + echo "Downloading kubectl from URL: $kubectlDownloadUrl" + curl -sSLf "$kubectlDownloadUrl" >$installPath/$kubectlBinary + sudo chmod 755 "$installPath/$kubectlBinary" + echo "kubectl is now executable in $installPath" +} + +# download_mkectl downloads the mkectl binary. +download_mkectl() { + if [ "$arch" = "x64" ] || [ "$arch" = "amd64" ]; + then + arch=x86_64 + fi + curl --silent -L -s https://s3.us-east-2.amazonaws.com/packages-stage-mirantis.com/${MKECTL_VERSION}/mkectl_${uname}_${arch}.tar.gz | tar -xvzf - -C $installPath + echo "mkectl is now executable in $installPath" +} + +main() { + + uname="$(detect_uname)" + arch="$(detect_arch)" + + printf "\n\n" + + echo "Step 1/3 : Install k0sctl" + echo "#########################" + + if [ -z "${K0SCTL_VERSION}" ]; then + echo "Using default k0sctl version 0.17.8" + K0SCTL_VERSION=0.17.8 + fi + + k0sctlBinary=k0sctl + installPath=/usr/local/bin + k0sctlDownloadUrl="$(download_k0sctl_url)" + + + echo "Downloading k0sctl from URL: $k0sctlDownloadUrl" + curl -sSLf "$k0sctlDownloadUrl" >"$installPath/$k0sctlBinary" + + sudo chmod 755 "$installPath/$k0sctlBinary" + echo "k0sctl is now executable in $installPath" + + printf "\n\n" + echo "Step 2/3 : Install kubectl" + echo "#########################" + + kubectlBinary=kubectl + + if [ -x "$(command -v "$kubectlBinary")" ]; then + VERSION="$($kubectlBinary version | grep Client | cut -d: -f2)" + echo "$kubectlBinary version $VERSION already exists." + else + install_kubectl + fi + + printf "\n\n" + echo "Step 3/3 : Install mkectl" + echo "#########################" + + if [ -z "${MKECTL_VERSION}" ]; then + echo "Using default mkectl version v4.0.0-alpha.0.3" + MKECTL_VERSION=v4.0.0-alpha.0.3 + fi + printf "\n" + + + echo "Downloading mkectl" + download_mkectl + +} + +main "$@" \ No newline at end of file From fed429361b6e31bd3dfae3e71a14dd67766942a9 Mon Sep 17 00:00:00 2001 From: Noah Merlis-Stephens Date: Mon, 3 Jun 2024 16:09:32 -0700 Subject: [PATCH 2/5] [BOP-602] Initial monitoring docs (#24) --- .github/.linkspector.yml | 3 ++ content/docs/reference/monitoring/README.md | 40 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 content/docs/reference/monitoring/README.md diff --git a/.github/.linkspector.yml b/.github/.linkspector.yml index 09c265f2..372d5d5b 100644 --- a/.github/.linkspector.yml +++ b/.github/.linkspector.yml @@ -2,3 +2,6 @@ dirs: - ./content/ useGitIgnore: true + +ignorePatterns: + - pattern: '^http://localhost:.*$' diff --git a/content/docs/reference/monitoring/README.md b/content/docs/reference/monitoring/README.md new file mode 100644 index 00000000..7759e582 --- /dev/null +++ b/content/docs/reference/monitoring/README.md @@ -0,0 +1,40 @@ +# Monitoring + +Mirantis Kubernetes Engine 4 (MKE4) uses the [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) a collection of Kubernetes manifests, [Grafana](https://grafana.com/) dashboards, and [Prometheus rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) combined with documentation and scripts to provide easy to operate end-to-end Kubernetes cluster monitoring with [Prometheus](https://prometheus.io/) using the [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator). + +## Configuration + +Grafana is enabled by default and may be toggled via the MKE4 config: +``` +monitoring: + enableGrafana: true +``` + +## Accessing the UIs + +Prometheus and Grafana dashboards can be accessed quickly using kubectl port-forward after running the quickstart via the commands below. + +### Prometheus + +`$ kubectl --namespace mke port-forward svc/prometheus-operated 9090` + +Then access via http://localhost:9090 + +### Grafana + +`$ kubectl --namespace mke port-forward svc/monitoring-grafana 3000:80` + +Then access via http://localhost:3000 + +## Opscare (Feature in progress) + +[Mirantis Opscare](https://www.mirantis.com/resources/opscare-datasheet/) is disabled by default and may be enabled via the MKE4 config. + +``` +monitoring: + enableOpscare: true +``` + +Enabling opscare installs the Prometheus [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) addon. In future releases, Opscare will additionally install a salesforce-notifier component as it does in MKE3. + + From 7037ca9cd4f10681ba7e6f792d57909743e342da Mon Sep 17 00:00:00 2001 From: sakshisharma84 Date: Wed, 5 Jun 2024 12:49:10 -0400 Subject: [PATCH 3/5] [NO JIRA][installation script] upgrade mkectl to latest version v4.0.0-alpha.0.5 (#25) --- content/docs/setup/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/setup/install.sh b/content/docs/setup/install.sh index 9148be84..f3c97dd8 100755 --- a/content/docs/setup/install.sh +++ b/content/docs/setup/install.sh @@ -108,8 +108,8 @@ main() { echo "#########################" if [ -z "${MKECTL_VERSION}" ]; then - echo "Using default mkectl version v4.0.0-alpha.0.3" - MKECTL_VERSION=v4.0.0-alpha.0.3 + echo "Using default mkectl version v4.0.0-alpha.0.5" + MKECTL_VERSION=v4.0.0-alpha.0.5 fi printf "\n" From 61550080c14aa91c0e75794d0453e604ff3975a0 Mon Sep 17 00:00:00 2001 From: Thomas Polkowski Date: Thu, 6 Jun 2024 11:18:22 -0400 Subject: [PATCH 4/5] fix formatting backuprestore docs (#20) --- .../docs/reference/backuprestore/README.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/content/docs/reference/backuprestore/README.md b/content/docs/reference/backuprestore/README.md index 471fb656..3f198fc8 100644 --- a/content/docs/reference/backuprestore/README.md +++ b/content/docs/reference/backuprestore/README.md @@ -32,14 +32,14 @@ Additionally, restoring a backup to a new set of nodes is not yet supported for ## All fields -| Field | Description | Default -|------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| enabled | Enables backup/restore functionality.
Valid values: true, false. | true -| storage_provider.type | What Storage Provider Type to use.
Valid values: 'InCluster', 'External'. | InCluster -| storage_provider.in_cluster_options.exposed | Whether to expose InCluster (MinIO) storage via NodePort.
Valid values: true, false. | true -| storage_provider.in_cluster_options.distributed | Whether to run MinIO in distributed mode.
Valid values: true, false. | false -| storage_provider.external_options.provider | What External Provider to use.
Valid values: Currently just 'aws'. | "" -| storage_provider.external_options.bucket | Name of the pre-created bucket to use for backup storage. | "" -| storage_provider.external_options.region | Region where the bucket exists. | "" -| storage_provider.external_options.credentials_file_path | Path to Credentials File. | "" -| storage_provider.external_options.credentials_file_profile | Profile in the Credentials file to use. | "" \ No newline at end of file +| Field | Description | Default | +|------------------------------------------------------------|-------------------------------------------------------------------------------------------------|---------------| +| enabled | Enables backup/restore functionality.
Valid values: true, false. | true | +| storage_provider.type | What Storage Provider Type to use.
Valid values: 'InCluster', 'External'. | InCluster | +| storage_provider.in_cluster_options.exposed | Whether to expose InCluster (MinIO) storage via NodePort.
Valid values: true, false. | true | +| storage_provider.in_cluster_options.distributed | Whether to run MinIO in distributed mode.
Valid values: true, false. | false | +| storage_provider.external_options.provider | What External Provider to use.
Valid values: Currently just 'aws'. | "" | +| storage_provider.external_options.bucket | Name of the pre-created bucket to use for backup storage. | "" | +| storage_provider.external_options.region | Region where the bucket exists. | "" | +| storage_provider.external_options.credentials_file_path | Path to Credentials File. | "" | +| storage_provider.external_options.credentials_file_profile | Profile in the Credentials file to use. | "" | \ No newline at end of file From e3658a47dd01176c8769ec7234982e862f1c9dce Mon Sep 17 00:00:00 2001 From: Magdalena Dziadosz <160592158+MagdaDziadosz@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:09:34 +0200 Subject: [PATCH 5/5] [DOC] Edit monitoring (#29) Co-authored-by: Kory <57411706+KoryKessel-Mirantis@users.noreply.github.com> --- content/docs/reference/monitoring/README.md | 40 ----------- .../docs/reference/monitoring/monitoring.md | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 40 deletions(-) delete mode 100644 content/docs/reference/monitoring/README.md create mode 100644 content/docs/reference/monitoring/monitoring.md diff --git a/content/docs/reference/monitoring/README.md b/content/docs/reference/monitoring/README.md deleted file mode 100644 index 7759e582..00000000 --- a/content/docs/reference/monitoring/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Monitoring - -Mirantis Kubernetes Engine 4 (MKE4) uses the [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) a collection of Kubernetes manifests, [Grafana](https://grafana.com/) dashboards, and [Prometheus rules](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) combined with documentation and scripts to provide easy to operate end-to-end Kubernetes cluster monitoring with [Prometheus](https://prometheus.io/) using the [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator). - -## Configuration - -Grafana is enabled by default and may be toggled via the MKE4 config: -``` -monitoring: - enableGrafana: true -``` - -## Accessing the UIs - -Prometheus and Grafana dashboards can be accessed quickly using kubectl port-forward after running the quickstart via the commands below. - -### Prometheus - -`$ kubectl --namespace mke port-forward svc/prometheus-operated 9090` - -Then access via http://localhost:9090 - -### Grafana - -`$ kubectl --namespace mke port-forward svc/monitoring-grafana 3000:80` - -Then access via http://localhost:3000 - -## Opscare (Feature in progress) - -[Mirantis Opscare](https://www.mirantis.com/resources/opscare-datasheet/) is disabled by default and may be enabled via the MKE4 config. - -``` -monitoring: - enableOpscare: true -``` - -Enabling opscare installs the Prometheus [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) addon. In future releases, Opscare will additionally install a salesforce-notifier component as it does in MKE3. - - diff --git a/content/docs/reference/monitoring/monitoring.md b/content/docs/reference/monitoring/monitoring.md new file mode 100644 index 00000000..db202db4 --- /dev/null +++ b/content/docs/reference/monitoring/monitoring.md @@ -0,0 +1,66 @@ +# Monitoring + +The MKE 4 monitoring setup is based on the [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack), +offering a comprehensive solution for collecting, storing, and visualizing metrics. + +## Monitoring tools + +Detail for the MKE 4 monitor tools is provided in the following table: + +| Monitoring tool | Default state | Configuration key | Description | +|------------|---------------|----------------------------|---------------------------------------------------------------------------------------| +| Grafana | enabled | `monitoring.enableGrafana` | Provides a web interface for viewing metrics and logs collected by Prometheus | +| Prometheus | enabled | - | Collects and stores metrics | +| Opscare | disabled | `monitoring.enableOpscare` | (Under development) Supplies additional monitoring capabilities, such as Alertmanager | + +## Grafana + +[Grafana](https://grafana.com/) is an open-source monitoring platform that provides a rich set of tools for visualizing time-series data. It +includes a variety of graph types and dashboards. + +Grafana is enabled in MKE 4 by default and may be disabled through the MKE configuration file: + +```yaml +monitoring: + enableGrafana: true +``` + +To access the Grafana dashboard: + +1. Run the following command to `port-forward` Grafana: + + ```bash + kubectl --namespace mke port-forward svc/monitoring-grafana 3000:80 + ``` + +2. Go to [http://localhost:3000](http://localhost:3000). + +## Prometheus + +[Prometheus](https://prometheus.io/) is an open-source monitoring and alerting +toolkit that is designed for reliability and scalability. It collects and stores metrics +as time series data, providing powerful query capabilities and a flexible alerting system. + +To access the Prometheus dashboard: + +1. Run the following command to `port-forward` Prometheus: + + ```bash + kubectl --namespace mke port-forward svc/prometheus-operated 9090 + ``` + +2. Go to [http://localhost:9090](http://localhost:9090). + +## Opscare (Under development) + +[Mirantis Opscare](https://www.mirantis.com/resources/opscare-datasheet/) is +an advanced monitoring and alerting solution. Once it is integrated, Mirantis Opscare will enhance the monitoring +capabilities of MKE 4 by incorporating additional tools and features, such as +[Prometheus Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/). + +Disabled by default, you can enable Mirantis Opscare through the MKE configuration file. + +```yaml +monitoring: + enableOpscare: true +```