Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'KIND' tool #81

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Add support for 'KIND' tool #81

wants to merge 10 commits into from

Conversation

khansaad
Copy link
Contributor

@khansaad khansaad commented Jun 11, 2024

Add support for Kind tool in case of Local monitoring

Description

This PR will do the following changes -

  • update the helper files and local monitoring demo script to support Kind instead of Minikube.

Type of change

  • Refactoring Code
  • New feature

How has this been tested?

  • In Progress.

Test Configuration

  • Kubernetes clusters tested on: Kind

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

Signed-off-by: Saad Khan <saakhan@redhat.com>
@khansaad khansaad added the enhancement New feature or request label Jun 11, 2024
@khansaad khansaad self-assigned this Jun 11, 2024
Signed-off-by: Saad Khan <saakhan@redhat.com>
@khansaad khansaad marked this pull request as ready for review June 12, 2024 08:24
@khansaad
Copy link
Contributor Author

Note: Need to merge the PR 1207 first as it contains the script to install prometheus on kind.

For testing, please take the file from that PR and put it in the scripts directory before running the demo.

###########################################
# Check if kind is installed
###########################################
function check_kind() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If check_kind fails to find Kind then Ask a prompt to install if yes then install

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, since this will require sudo permissions, we won't be giving the option to the user to automatically install it.

function check_kind() {
if ! which kind >/dev/null 2>/dev/null; then
echo "ERROR: Please install kind and try again"
print_min_resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the resource requirements same? Update the message in print_min_resources with cluster_type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we're keeping it the same as minikube.
Updated the message now to make it cluster_type specific.

Signed-off-by: Saad Khan <saakhan@redhat.com>
@khansaad khansaad requested a review from chandrams June 14, 2024 12:35
@chandrams
Copy link
Contributor

@khansaad - As discussed, please check if the below issue is seen:

Error: Port 8080 is already in use. Port forwarding for kruize service cannot be established.
Error: Port 8081 is already in use. Port forwarding for kruize-ui-nginx-service cannot be established.
Error: Port 8082 is already in use. Port forwarding for tfb-service cannot be established.
######################################################
#     Listing all datsources known to Kruize
######################################################
Handling connection for 8080
E0614 13:06:56.352450 1608387 portforward.go:409] an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod 3b01f05d5b338612c00bfbd4c77aa5690b8a6a58641750864b47a4afe422d68e, uid : failed to find sandbox "3b01f05d5b338612c00bfbd4c77aa5690b8a6a58641750864b47a4afe422d68e" in store: not found
curl: (52) Empty reply from server
error: lost connection to pod
######################################################
#     Import metadata from prometheus-1 datasource
######################################################
curl: (7) Failed to connect to 127.0.0.1 port 8080 after 0 ms: Couldn't connect to server

Signed-off-by: Saad Khan <saakhan@redhat.com>
@khansaad
Copy link
Contributor Author

@khansaad - As discussed, please check if the below issue is seen:

Error: Port 8080 is already in use. Port forwarding for kruize service cannot be established.
Error: Port 8081 is already in use. Port forwarding for kruize-ui-nginx-service cannot be established.
Error: Port 8082 is already in use. Port forwarding for tfb-service cannot be established.
######################################################
#     Listing all datsources known to Kruize
######################################################
Handling connection for 8080
E0614 13:06:56.352450 1608387 portforward.go:409] an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod 3b01f05d5b338612c00bfbd4c77aa5690b8a6a58641750864b47a4afe422d68e, uid : failed to find sandbox "3b01f05d5b338612c00bfbd4c77aa5690b8a6a58641750864b47a4afe422d68e" in store: not found
curl: (52) Empty reply from server
error: lost connection to pod
######################################################
#     Import metadata from prometheus-1 datasource
######################################################
curl: (7) Failed to connect to 127.0.0.1 port 8080 after 0 ms: Couldn't connect to server

Added the check for the same and exit the demo if port is unavailable.

@chandrams
Copy link
Contributor

@khansaad - I 'm not seeing cpu recommendations with kind too, can you please check

  "recommendation_engines": {
                        "cost": {
                          "pods_count": 0,
                          "confidence_level": 0.0,
                          "config": {
                            "requests": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            },
                            "limits": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            }
                          },
                          "variation": {
                            "requests": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            },
                            "limits": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            }
                          },

@khansaad
Copy link
Contributor Author

khansaad commented Jul 2, 2024

@khansaad - I 'm not seeing cpu recommendations with kind too, can you please check

  "recommendation_engines": {
                        "cost": {
                          "pods_count": 0,
                          "confidence_level": 0.0,
                          "config": {
                            "requests": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            },
                            "limits": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            }
                          },
                          "variation": {
                            "requests": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            },
                            "limits": {
                              "memory": {
                                "amount": 2.586329088E8,
                                "format": "bytes"
                              }
                            }
                          },

Fixed now. Attached the latest response JSON
kind-demo-run-response.json

Signed-off-by: Saad Khan <saakhan@redhat.com>
@chandrams
Copy link
Contributor

@khansaad I 'm getting this error with prometheus install using v0.13.0, is there anything I 'm missing out here?

servicemonitor.monitoring.coreos.com/prometheus-k8s serverside-applied
resource mapping not found for name: "alertmanager-main" namespace: "monitoring" from "alertmanager-podDisruptionBudget.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"
ensure CRDs are installed first
resource mapping not found for name: "prometheus-k8s" namespace: "monitoring" from "prometheus-podDisruptionBudget.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"
ensure CRDs are installed first
Error: Unable to install prometheus
ERROR: Prometheus failed to start, exiting

Kubectl version

kubectl version
Client Version: v1.28.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.0

@khansaad
Copy link
Contributor Author

khansaad commented Jul 3, 2024

@khansaad I 'm getting this error with prometheus install using v0.13.0, is there anything I 'm missing out here?


servicemonitor.monitoring.coreos.com/prometheus-k8s serverside-applied

resource mapping not found for name: "alertmanager-main" namespace: "monitoring" from "alertmanager-podDisruptionBudget.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"

ensure CRDs are installed first

resource mapping not found for name: "prometheus-k8s" namespace: "monitoring" from "prometheus-podDisruptionBudget.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"

ensure CRDs are installed first

Error: Unable to install prometheus

ERROR: Prometheus failed to start, exiting

Kubectl version


kubectl version

Client Version: v1.28.0

Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

Server Version: v1.28.0

Please confirm that minikube isn't running as well. Try stopping/deleting minikube once and run the demo again.

@chandrams
Copy link
Contributor

@khansaad minikube is not running, I had deleted it before trying this script

Signed-off-by: Saad Khan <saakhan@redhat.com>
@chandrams
Copy link
Contributor

Finally got it working by deleting kind_downloads, thanks @khansaad

Copy link
Contributor

@chandrams chandrams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# Conflicts:
#	monitoring/local_monitoring/local_monitoring_demo.sh
@rbadagandi1 rbadagandi1 added this to the Kruize 0.0.24_rm Release milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request remote_monitoring
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

None yet

4 participants