KRS works seamlessly across cloud providers (AWS, Azure, GCP, etc.). Manage your Kubernetes clusters effortlessly, regardless of your cloud choice.
This is the multi-page printable view of this section. Click here to print.
Cloud Providers
- 1: Azure EKS
- 2: DigitalOcean
- 3: AWS EKS
- 4: Google's GKE
1 - Azure EKS
Optimize your AKS cluster management with KRS. This powerful tool, installed locally on your machine, analyzes your AKS cluster to identify areas for improvement. KRS leverages AI to provide recommendations for enhancing your cluster’s efficiency and functionality.
Prerequisites:
- An Azure account
- Install Azure CLI on your laptop
Installation
Clone the repository using the command
git clone https://github.com/kubetoolsca/krs.git
Install the Krs Tool
Change directory to /krs and run the following command to install krs locally on your system:
pip install .
Check if the tool has been successfully installed using
krs --help
krs --help Usage: krs [OPTIONS] COMMAND [ARGS]... ** krs: A command line interface to scan your Kubernetes Cluster, detect errors, provide resolutions using LLMs and recommend latest tools for your cluster ╭─ Options ────────────────────────────────────────────────────────────────────╮ │ --install-completion Install completion for the current shell. ** │ │ --show-completion Show completion for the current shell, to copy │ │ it or customize the installation. ** │ │ --help Show this message and exit. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ │ exit Ends krs services safely and deletes all state files from │ │ system. **Removes all cached data. ** │ │ export Exports pod info with logs and events. ** │ │ health Starts an interactive terminal using an LLM of your choice to │ │ detect and fix issues with your cluster │ │ init Initializes the services and loads the scanner. ** │ │ namespaces Lists all the namespaces. ** │ │ pods Lists all the pods with namespaces, or lists pods under a │ │ specified namespace. ** │ │ recommend Generates a table of recommended tools from our ranking │ │ database and their CNCF project status. ** │ │ scan Scans the cluster and extracts a list of tools that are │ │ currently used. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯
Once you get a list of commands you can move onto the next part.
Create an EKS cluster on your Azure account
Create an EKS Cluster
To create an EKS account, you can log into your account and search for Azure Kubernetes Service.
Once you click create, you can name your cluster, add a node pool (I used the default agent pool but you can create your own), and leave everything else to its default state. **This will help you create a cluster.
Install Azure CLI
brew update && brew install azure-cli
Log into your Azure account
Once the CLI is installed, log into your Azure account using the command:
az login
Connect to Your Cluster
Retrieve the connection command from your cluster details on the Azure portal and execute it to connect to your cluster.
Using Krs
Initialise Krs
krs init
Scan the Clusters
krs scan Scanning your cluster... Cluster scanned successfully... Extracted tools used in cluster... The cluster is using the following tools: +-------------+--------+-----------------------------+---------------+ | Tool Name | Rank | Category | CNCF Status | +=============+========+=============================+===============+ | autoscaler | 5 | Cluster with Core CLI tools | unlisted | +-------------+--------+-----------------------------+---------------+
Get Recommended Tools
% krs recommend` Our recommended tools for this deployment are: +-----------------------------+------------------+-------------+---------------+ | Category | Recommendation | Tool Name | CNCF Status | +=============================+==================+=============+===============+ | Cluster with Core CLI tools | Recommended tool | k9s | unlisted | +-----------------------------+------------------+-------------+---------------+
Installing a few tools
brew install helm helm install kubeview kubeview
helm install kubeview kubeview NAME: kubeview LAST DEPLOYED: Sat Jun 29 21:44:17 2024 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: ===================================== ==== KubeView has been deployed! ==== ===================================== To get the external IP of your application, run the following: export SERVICE_IP=$(kubectl get svc --namespace default kubeview -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace default svc -w kubeview'
Exports pod info with logs and events
krs export Pod info with logs and events exported. **Json file saved to current directory! ``` meetsimarkaur@meetsimars-MBP krs % ls CODE_OF_CONDUCT.md arch.png gke.md kubeview CONTRIBUTIONS.md bhive.png krs samples LICENSE build krs.egg-info setup.py README.md exported_pod_info.json kubetail
Detecting and Fixing Issues with my cluster
krs health` Starting interactive terminal... Choose the model provider for healthcheck: [1] OpenAI [2] Huggingface >> 1 Installing necessary libraries......... openai is already installed. Enter your OpenAI API key: sk-proj-xxxxxxx Enter the OpenAI model name: gpt-3.5-turbo API key and model are valid. Namespaces in the cluster: 1. **default 2. **kube-node-lease 3. **kube-public 4. **kube-system Which namespace do you want to check the health for? Select a namespace by entering its number: >> 1 Pods in the namespace default: 1. **kubeview-64fd5d8b8c-khv8v Which pod from default do you want to check the health for? Select a pod by entering its number: >> 1 Checking status of the pod... Extracting logs and events from the pod... Logs and events from the pod extracted successfully! Interactive session started. **Type 'end chat' to exit from the session! >> Everything looks good! Since the log entries provided are empty, there are no warnings or errors to analyze or address. **If there were actual log entries to review, common steps to resolve potential issues in a Kubernetes environment could include: 1. **Checking the configuration files for any errors or inconsistencies. 2. **Verifying that all necessary resources (e.g. **pods, services, deployments) are running as expected. 3. **Monitoring the cluster for any performance issues or resource constraints. 4. **Troubleshooting any networking problems that may be impacting connectivity. 5. **Updating Kubernetes components or applying patches as needed to ensure system stability and security. 6. **Checking logs of specific pods or services for more detailed error messages to pinpoint the root cause of any issues. >> 2 >> Since the log entries are still empty, the response remains the same: Everything looks good! If you encounter any specific issues or errors in the future, feel free to provide the logs for further analysis and troubleshooting.
With KRS, you can effortlessly identify and optimize the tools within your Kubernetes clusters, whether on-premises or in the public cloud, simplifying your Kubernetes management journey.
2 - DigitalOcean
KRS is your Kubernetes sidekick, effortlessly optimizing your Digital Ocean cluster. Simply install, initialize, and scan to uncover hidden potential.
Prerequisites
- Digital Ocean Account
- Homebrew(if you’re on Mac)
Getting Started
Setup a Kubernetes Cluster on Digital Ocean
Install and Setup doctl on your Local Machine
If on Ubuntu use:
sudo snap install doctl sudo snap connect doctl:kube-config sudo snap connect doctl:ssh-keys :ssh-keys sudo snap connect doctl:dot-docker
If on Mac, use:
brew install doctl
Authenticate your Digital Ocean Account
doctl auth init
Connect your Local Machine to your Digital Ocean Kubernetes Cluster
doctl kubernetes cluster kubeconfig save ea3a5a97-fdba-4455-bd81-46df80c68267
Setup KRS using these commands
git clone https://github.com/kubetoolsca/krs.git cd krs pip install .
Initialize KRS to permit it access to your cluster using the given command
krs init
Get a view of all possible actions with KRS, by running the given command
krs --help
krs --help Usage: krs [OPTIONS] COMMAND [ARGS]... ** krs: A command line interface to scan your Kubernetes Cluster, detect errors, provide resolutions using LLMs and recommend latest tools for your cluster ╭─ Options ────────────────────────────────────────────────────────────────────╮ │ --install-completion Install completion for the current shell. ** │ │ --show-completion Show completion for the current shell, to copy │ │ it or customize the installation. ** │ │ --help Show this message and exit. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ │ exit Ends krs services safely and deletes all state files from │ │ system. **Removes all cached data. ** │ │ export Exports pod info with logs and events. ** │ │ health Starts an interactive terminal using an LLM of your choice to │ │ detect and fix issues with your cluster │ │ init Initializes the services and loads the scanner. ** │ │ namespaces Lists all the namespaces. ** │ │ pods Lists all the pods with namespaces, or lists pods under a │ │ specified namespace. ** │ │ recommend Generates a table of recommended tools from our ranking │ │ database and their CNCF project status. ** │ │ scan Scans the cluster and extracts a list of tools that are │ │ currently used. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯
Permit KRS to get information on the tools utilized in your cluster by running the given command
krs scan
krs scan Scanning your cluster... Cluster scanned successfully... Extracted tools used in cluster... The cluster is using the following tools: +-------------+--------+------------------+---------------+ | Tool Name | Rank | Category | CNCF Status | +=============+========+==================+===============+ | cilium | 1 | Network Policies | graduated | +-------------+--------+------------------+---------------+ | hubble | 7 | Security Tools | listed | +-------------+--------+------------------+---------------+
Get recommendations on possible tools to use in your cluster by running the given command
krs recommend
krs recommend Our recommended tools for this deployment are: +------------------+------------------------+-------------+---------------+ | Category | Recommendation | Tool Name | CNCF Status | +==================+========================+=============+===============+ | Network Policies | Already using the best | cilium | graduated | +------------------+------------------------+-------------+---------------+ | Security Tools | Recommended tool | trivy | listed | +------------------+------------------------+-------------+---------------+
Check the pod and namespace status in your Kubernetes cluster, including errors.
krs health
krs health Starting interactive terminal... Choose the model provider for healthcheck: [1] OpenAI [2] Huggingface >> 1 Installing necessary libraries.......... openai is already installed. Enter your OpenAI API key: sk-proj-qxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxP Enter the OpenAI model name: gpt-3.5-turbo API key and model are valid. Namespaces in the cluster: 1. **default 2. **kube-node-lease 3. **kube-public 4. **kube-system 5. **portainer Which namespace do you want to check the health for? Select a namespace by entering its number: >> 4 Pods in the namespace kube-system: 1. **cilium-9lqbq 2. **cilium-ffpct 3. **cilium-pvknr 4. **coredns-85f59d8784-nvr2n 5. **coredns-85f59d8784-p9jcv 6. **cpc-bridge-proxy-c6xzr 7. **cpc-bridge-proxy-p7r4p 8. **cpc-bridge-proxy-tkfrd 9. **csi-do-node-hwxn7 10. **csi-do-node-q27rc 11. **csi-do-node-rn7dm 12. **do-node-agent-6t5ms 13. **do-node-agent-85r8b 14. **do-node-agent-m7bvr 15. **hubble-relay-74686df4df-856pj 16. **hubble-ui-86cc69bddc-xc745 17. **konnectivity-agent-9k8vk 18. **konnectivity-agent-h5fm2 19. **konnectivity-agent-kf4xh 20. **kube-proxy-94945 21. **kube-proxy-qgv4j 22. **kube-proxy-vztzf Which pod from kube-system do you want to check the health for? Select a pod by entering its number: >> 1 Checking status of the pod... Extracting logs and events from the pod... Logs and events from the pod extracted successfully! Interactive session started. **Type 'end chat' to exit from the session! >> The log entries provided are empty {}, so there is nothing to analyze. **Therefore, I can confirm that 'Everything looks good!' in this case. If there were warnings or errors in the log entries, I would have analyzed them thoroughly to identify the root cause. **Depending on the specific warnings or errors, potential steps to resolve the issues could include: 1. **Analyzing the specific error message to understand the problem 2. **Checking Kubernetes resources (e.g., pods, deployments, configmaps) for any misconfigurations 3. **Verifying connectivity to external resources or dependencies 4. **Checking for resource limitations or constraints that could be causing issues 5. **Reviewing recent changes in the Kubernetes environment that could have introduced problems 6. **Using Kubernetes troubleshooting tools like kubectl logs, describe, or events to gather more information By following these steps and addressing any identified issues, you can resolve warnings or errors in the Kubernetes environment. >> Wonderful, anything else to note? >> In addition to resolving warnings or errors in Kubernetes logs, it's important to regularly monitor and maintain the Kubernetes environment to ensure smooth operation. **Some best practices for Kubernetes maintenance include: 1. **Regularly updating Kubernetes components and cluster nodes to the latest stable versions to benefit from bug fixes and security patches. 2. **Implementing automated backups of critical data and configurations to prevent data loss in case of failures. 3. **Monitoring resource utilization and scaling components as needed to optimize performance and cost efficiency. 4. **Implementing security best practices, such as network policies, RBAC, and pod security policies to protect the cluster from unauthorized access or malicious activities. 5. **Conducting regular health checks and performance tuning to identify and address any bottlenecks or inefficiencies in the cluster. 6. **Developing a disaster recovery plan and testing it periodically to ensure business continuity in case of unexpected events. By following these maintenance practices, you can ensure the stability, scalability, and security of your Kubernetes environment for optimal DevOps operations. >> Alright, so are we done? >> Yes, we have covered the analysis of the Kubernetes log entries and discussed best practices for Kubernetes maintenance. **If you have any more questions or need further assistance, feel free to ask. **Otherwise, we can consider this conversation complete. >> Wonderful. **Thanks! end chat >> You're welcome! If you have any more questions in the future, feel free to reach out. **Have a great day! Goodbye! >> end chat
3 - AWS EKS
Optimize your EKS cluster with KRS. KRS running locally on your machine, analyzes your EKS cluster for improvement. Leverage KRS to gain valuable insights and recommendations for a smoother Kubernetes experience.
Prerequisites
- AWS Account
- AWSCLI installed on your system
- Homebrew(if you’re on Mac)
Getting Started
Setup Amazon EKS Cluster
eksctl create cluster --name <cluster_name> --version <kubernetes_version> --region <aws_region_name e.g us-east-1> --nodegroup-name <linux_nodes> --node-type <node_type> --nodes <number_of_nodes> --zones=<zone_names, e.g: us-east-1a,us-east-1b>
Authenticate your AWS account
aws configure
Extract the list of running clusters on AWS using this command
aws eks list-clusters
Create a config file that permits KRS access to the EKS cluster using this command
aws eks update-kubeconfig --name <cluster_name>
Setup KRS using these commands
$git clone https://github.com/kubetoolsca/krs.git $ cd krs $ pip install
Initialize KRS to permit it access to your cluster using the given command
krs init
Get a view of all possible actions with KRS, by running the given command
krs --help Usage: krs [OPTIONS] COMMAND [ARGS]... ** krs: A command line interface to scan your Kubernetes Cluster, detect errors, provide resolutions using LLMs and recommend latest tools for your cluster ╭─ Options ────────────────────────────────────────────────────────────────────╮ │ --install-completion Install completion for the current shell. ** │ │ --show-completion Show completion for the current shell, to copy │ │ it or customize the installation. ** │ │ --help Show this message and exit. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ │ exit Ends krs services safely and deletes all state files from │ │ system. **Removes all cached data. ** │ │ export Exports pod info with logs and events. ** │ │ health Starts an interactive terminal using an LLM of your choice to │ │ detect and fix issues with your cluster │ │ init Initializes the services and loads the scanner. ** │ │ namespaces Lists all the namespaces. ** │ │ pods Lists all the pods with namespaces, or lists pods under a │ │ specified namespace. ** │ │ recommend Generates a table of recommended tools from our ranking │ │ database and their CNCF project status. ** │ │ scan Scans the cluster and extracts a list of tools that are │ │ currently used. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯
Permit KRS to get information on the tools utilized in your cluster by running the given command
krs scan Scanning your cluster... Cluster scanned successfully... Extracted tools used in cluster... The cluster is using the following tools: +-------------+--------+-----------------------------+---------------+ | Tool Name | Rank | Category | CNCF Status | +=============+========+=============================+===============+ | autoscaler | 5 | Cluster with Core CLI tools | unlisted | +-------------+--------+-----------------------------+---------------+ | istio | 2 | Service Mesh | graduated | +-------------+--------+-----------------------------+---------------+ | kserve | 3 | Artificial Intelligence | listed | +-------------+--------+-----------------------------+---------------+
Get recommendations on possible tools to use in your cluster by running the given command
krs recommend
+-----------------------------+------------------+-------------+---------------+ | Category | Recommendation | Tool Name | CNCF Status | +=============================+==================+=============+===============+ | Cluster with Core CLI tools | Recommended tool | k9s | unlisted | +-----------------------------+------------------+-------------+---------------+ | Service Mesh | Recommended tool | traefik | listed | +-----------------------------+------------------+-------------+---------------+ | Artificial Intelligence | Recommended tool | k8sgpt | sandbox | +-----------------------------+------------------+-------------+---------------+
Check the pod and namespace status in your Kubernetes cluster, including errors
krs health
Starting interactive terminal... Choose the model provider for healthcheck: [1] OpenAI [2] Huggingface >> 1 Installing necessary libraries.......... openai is already installed. Enter your OpenAI API key: sk-proj-xxxxxxxxxx Enter the OpenAI model name: gpt-3.5-turbo API key and model are valid. Namespaces in the cluster: 1. **cert-manager 2. **default 3. **istio-system 4. **knative-serving 5. **kserve 6. **kserve-test 7. **kube-node-lease 8. **kube-public 9. **Kube-system Which namespace do you want to check the health for? Select a namespace by entering its number: >> 9 Pods in the namespace kube-system: 1. **aws-node-46hzm 2. **aws-node-wdgnn 3. **coredns-586b798467-54t6h 4. **coredns-586b798467-jmlrp 5. **kube-proxy-hfmjl 6. **kube-proxy-n8lc6 Which pod from kube-system do you want to check the health for? Select a pod by entering its number: >> 1 Checking status of the pod... Extracting logs and events from the pod... Logs and events from the pod extracted successfully! Interactive session started. **Type 'end chat' to exit from the session! >> The provided log entries are empty, so there is nothing to analyze. **Everything looks good! >> Wonderful, so what next >> If you have any specific questions or another set of log entries you would like me to analyze, feel free to provide them. **I'm here to help with any DevOps or Kubernetes-related queries you may have. **Just let me know how I can assist you further!
4 - Google's GKE
Effortlessly optimize your GKE cluster with KRS. This powerful tool, running locally on your machine, analyzes your GKE cluster for improvement. Leverage KRS to gain valuable insights and recommendations for a smoother Kubernetes experience.
Prerequisite
- A Google Cloud Account
- Installing Google Cloud SDK on your macOS
Getting Started
Execute the following command to install Google Cloud SDK in your system
tar xfz google-cloud-sdk-195.0.0-darwin-x86_64.tar.gz ./google-cloud-sdk/install.sh
Enable Google Cloud Engine API
Authenticate Your Google Cloud using gcloud auth
gcloud init
In your browser, log in to your Google user account when prompted and click Allow to grant permission to access Google Cloud Platform resources.
Creating GKE Cluster
gcloud container clusters create k8s-lab1 --disk-size 10 --zone asia-east1-a --machine-type n1-standard-2 --num-nodes 3 --scopes compute-rw
Viewing it on Google Cloud Platform
Viewing the new context on Docker Desktop
Verifying the Google Kubernetes Cluster
kubectl get nodes NAME STATUS ROLES AGE VERSION gke-k8s-lab1-default-pool-5dfb7153-3fr7 Ready <none> 3m1s v1.29.4-gke.1043002 gke-k8s-lab1-default-pool-5dfb7153-nl3v Ready <none> 3m1s v1.29.4-gke.1043002 gke-k8s-lab1-default-pool-5dfb7153-rkg8 Ready <none> 3m2s v1.29.4-gke.1043002
Initialize the KRS
krs init Services initialized and scanner loaded.
Running the scanner
krs scan Scanning your cluster... Cluster scanned successfully... Extracted tools used in cluster... The cluster is using the following tools: +-------------+--------+-----------------------------+---------------+ | Tool Name | Rank | Category | CNCF Status | +=============+========+=============================+===============+ | autoscaler | 5 | Cluster with Core CLI tools | unlisted | +-------------+--------+-----------------------------+---------------+ | fluentbit | 4 | Logging and Tracing | unlisted | +-------------+--------+-----------------------------+---------------+
Checking the Krs Recommendation
krs recommend Our recommended tools for this deployment are: +-----------------------------+------------------+-------------+---------------+ | Category | Recommendation | Tool Name | CNCF Status | +=============================+==================+=============+===============+ | Cluster with Core CLI tools | Recommended tool | k9s | unlisted | +-----------------------------+------------------+-------------+---------------+ | Logging and Tracing | Recommended tool | elk | unlisted |
Installing Kubeview
git clone https://github.com/benc-uk/kubeview cd kubeview/charts/ helm install kubeview kubeview
Running the scanner again
krs scan Scanning your cluster... Cluster scanned successfully... Extracted tools used in cluster... The cluster is using the following tools: +-------------+--------+-----------------------------+---------------+ | Tool Name | Rank | Category | CNCF Status | +=============+========+=============================+===============+ | kubeview | 30 | Cluster with Core CLI tools | unlisted | +-------------+--------+-----------------------------+---------------+ | | 3 | Cluster Management | unlisted | +-------------+--------+-----------------------------+---------------+ | autoscaler | 5 | Cluster with Core CLI tools | unlisted | +-------------+--------+-----------------------------+---------------+ | fluentbit | 4 | Logging and Tracing | unlisted | +-------------+--------+-----------------------------+---------------+
Discover other KRS commands
krs --help
krs --help Usage: krs [OPTIONS] COMMAND [ARGS]... ** krs: A command line interface to scan your Kubernetes Cluster, detect errors, provide resolutions using LLMs and recommend latest tools for your cluster ╭─ Options ────────────────────────────────────────────────────────────────────╮ │ --install-completion Install completion for the current shell. ** │ │ --show-completion Show completion for the current shell, to copy │ │ it or customize the installation. ** │ │ --help Show this message and exit. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ │ exit Ends krs services safely and deletes all state files from │ │ system. **Removes all cached data. ** │ │ export Exports pod info with logs and events. ** │ │ health Starts an interactive terminal using an LLM of your choice to │ │ detect and fix issues with your cluster │ │ init Initializes the services and loads the scanner. ** │ │ namespaces Lists all the namespaces. ** │ │ pods Lists all the pods with namespaces, or lists pods under a │ │ specified namespace. ** │ │ recommend Generates a table of recommended tools from our ranking │ │ database and their CNCF project status. ** │ │ scan Scans the cluster and extracts a list of tools that are │ │ currently used. ** │ ╰──────────────────────────────────────────────────────────────────────────────╯