-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Created kind k8s installation guide #34
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA new document, Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (3)
kind_ec2_installation.md (3)
14-18: Add system requirements to prerequisitesConsider adding specific system requirements:
- Minimum RAM (e.g., 4GB recommended for Kind)
- Minimum CPU cores (e.g., 2 cores recommended)
- Required disk space for Docker images and Kind clusters
33-61: Add Docker post-installation verification stepsConsider adding these verification steps after Docker installation:
- Verify Docker daemon is running properly:
docker run hello-world
- Check Docker info:
docker info🧰 Tools
🪛 LanguageTool
[uncategorized] ~44-~44: It seems likely that a singular genitive (’s) apostrophe is missing.
Context: ...arted and enabled by default. Verify if its started and enabled using `sudo systemc...(AI_HYDRA_LEO_APOSTROPHE_S_XS)
44-44: Fix grammar and formatting issues
- Fix apostrophe in line 44:
-Verify if its started +Verify if it's started
- Remove spaces inside emphasis markers in line 72:
-** Validate the downloaded kubectl binary ** +**Validate the downloaded kubectl binary**Also applies to: 72-72
🧰 Tools
🪛 LanguageTool
[uncategorized] ~44-~44: It seems likely that a singular genitive (’s) apostrophe is missing.
Context: ...arted and enabled by default. Verify if its started and enabled using `sudo systemc...(AI_HYDRA_LEO_APOSTROPHE_S_XS)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
kind_ec2_installation.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
kind_ec2_installation.md
[uncategorized] ~44-~44: It seems likely that a singular genitive (’s) apostrophe is missing.
Context: ...arted and enabled by default. Verify if its started and enabled using `sudo systemc...
(AI_HYDRA_LEO_APOSTROPHE_S_XS)
🪛 Markdownlint
kind_ec2_installation.md
72-72: null
Spaces inside emphasis markers
(MD037, no-space-in-emphasis)
| ### 4. Install kubectl | ||
|
|
||
| Download **kubectl**, which is a Kubernetes command-line tool. | ||
|
|
||
| * Download kubectl binary with curl on Linux | ||
| ```bash | ||
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | ||
| ``` | ||
|
|
||
| > **Optional**: **Validate the downloaded kubectl binary ** | ||
| > * Download the kubectl checksum file | ||
| > `curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"` | ||
| > * Validate the kubectl binary against the checksum file | ||
| > `echo "$(cat kubectl.sha256) kubectl" | sha256sum --check` | ||
| > * If valid, the output is `kubectl: OK` | ||
|
|
||
| * Install kubectl | ||
| ```bash | ||
| sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | ||
| ``` | ||
|
|
||
| * Verify installation by checking kubectl version | ||
| ```bash | ||
| kubectl version --client | ||
| ``` | ||
|
|
||
|  | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Specify kubectl version compatibility
Add a note about kubectl version compatibility with Kind. The kubectl version should be within one minor version of the Kind cluster's Kubernetes version.
🧰 Tools
🪛 Markdownlint
72-72: null
Spaces inside emphasis markers
(MD037, no-space-in-emphasis)
| <img src="https://github.com/user-attachments/assets/2942ee8e-7e11-4f58-a1de-bc939a33b8ab" alt="kind logo" style="height: 50px; width: auto;"> | ||
| <img src="https://github.com/user-attachments/assets/2af10983-a2f4-492a-961c-28b6f36f977a" alt="k8s logo" style="height: 50px; width: auto;"> | ||
| <img src="https://github.com/user-attachments/assets/9f1b82ea-d285-43ed-b7de-564019075ab1" alt="docker logo" style="height: 50px; width: auto;"> | ||
| <img src="https://github.com/user-attachments/assets/51fea0a8-3a8c-4727-8129-784c35f1389c" alt="ec2 logo" style="height: 50px; width: auto;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using permanent image URLs
The current image URLs use temporary paths (user-attachments). Consider:
- Moving images to a permanent location in the repository (e.g.,
docs/images/) - Using relative paths to reference them
-<img src="https://github.com/user-attachments/assets/2942ee8e-7e11-4f58-a1de-bc939a33b8ab" alt="kind logo" style="height: 50px; width: auto;">
+<img src="docs/images/kind-logo.png" alt="kind logo" style="height: 50px; width: auto;">Committable suggestion skipped: line range outside the PR's diff.
| Download and install **kind** k8s | ||
| * Download kind binary with curl on Linux | ||
| ```bash | ||
| [ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve version handling and architecture support
- Consider using a version variable instead of hardcoding:
-[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64
+KIND_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep tag_name | cut -d '"' -f 4)
+if [ $(uname -m) = x86_64 ]; then
+ curl -Lo ./kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64
+elif [ $(uname -m) = aarch64 ]; then
+ curl -Lo ./kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-arm64
+else
+ echo "Unsupported architecture"
+ exit 1
+fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| [ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64 | |
| KIND_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep tag_name | cut -d '"' -f 4) | |
| if [ $(uname -m) = x86_64 ]; then | |
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64 | |
| elif [ $(uname -m) = aarch64 ]; then | |
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-arm64 | |
| else | |
| echo "Unsupported architecture" | |
| exit 1 | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Outside diff range and nitpick comments (1)
kind_ec2_installation.md (1)
9-11: Enhance the cost warning messageConsider adding more specific cost information:
- Include approximate hourly/monthly costs for t2.medium
- Link to AWS pricing calculator
- Mention minimum resource requirements (CPU/RAM) for running Kind
> ⚠️ **Caution:** > This installation guide recommends using a `t2.medium` EC2 instance, which is **NOT** covered under the AWS Free Tier. -> Please be aware that using this instance type may incur **ADDITIONAL CHARGES**. For optimal performance with Kind K8s, it is advised to use a higher-tier EC2 instance to meet the computational requirements and **not** `t2.micro`. +> Please be aware that: +> - A t2.medium instance costs approximately $0.0464 per hour (varies by region) +> - Minimum requirements for Kind: 2 CPU cores and 2GB RAM +> - For pricing details, visit [AWS Pricing Calculator](https://calculator.aws/#/) +> - Using t2.micro is **NOT** recommended as it lacks sufficient resources
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
kind_ec2_installation.md(1 hunks)
🧰 Additional context used
🪛 Markdownlint
kind_ec2_installation.md
72-72: null
Spaces inside emphasis markers
(MD037, no-space-in-emphasis)
| ### 3. Install Docker | ||
|
|
||
| Since **kind** runs Kubernetes clusters using Docker containers as nodes, Docker needs to be installed. | ||
|
|
||
| * Install Docker using the below command | ||
| ```bash | ||
| sudo apt install docker.io -y | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
| Docker service will be started and enabled by default. Verify if its started and enabled using `sudo systemctl status docker` | ||
|
|
||
|  | ||
|
|
||
| * If Docker service is not started or enabled, do it using the command below | ||
| ```bash | ||
| sudo systemctl enable --now docker | ||
| ``` | ||
|
|
||
| * Add current user to docker group (To use docker without root) | ||
|
|
||
| ```bash | ||
| sudo usermod -aG docker $USER && newgrp docker | ||
| ``` | ||
| * Verify using `docker --version` | ||
|
|
||
|  | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance Docker installation security
Consider adding security best practices and version pinning:
- Pin Docker version for reproducibility
- Add post-installation security steps
- Include Docker daemon configuration
### 3. Install Docker
+
+It's recommended to install a specific version of Docker for reproducibility:
+
+```bash
+DOCKER_VERSION="24.0.7"
+sudo apt install docker.io=${DOCKER_VERSION}* -y
+```
+
+Configure Docker daemon with security best practices:
+
+```bash
+sudo tee /etc/docker/daemon.json <<EOF
+{
+ "log-driver": "json-file",
+ "log-opts": {
+ "max-size": "100m"
+ },
+ "default-ulimits": {
+ "nofile": {
+ "Name": "nofile",
+ "Hard": 64000,
+ "Soft": 64000
+ }
+ }
+}
+EOF
+
+sudo systemctl restart docker
+```| > **Optional**: **Validate the downloaded kubectl binary ** | ||
| > * Download the kubectl checksum file | ||
| > `curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"` | ||
| > * Validate the kubectl binary against the checksum file | ||
| > `echo "$(cat kubectl.sha256) kubectl" | sha256sum --check` | ||
| > * If valid, the output is `kubectl: OK` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make checksum verification mandatory
The checksum verification step should not be optional as it ensures the integrity and authenticity of the kubectl binary.
-Optional**: **Validate the downloaded kubectl binary **
-> * Download the kubectl checksum file
-> `curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"`
-> * Validate the kubectl binary against the checksum file
-> `echo "$(cat kubectl.sha256) kubectl" | sha256sum --check`
-> * If valid, the output is `kubectl: OK`
+**Important**: Verify kubectl binary integrity
+
+```bash
+# Download kubectl checksum file
+curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
+
+# Validate kubectl binary (Required)
+echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
+
+# Proceed only if verification succeeds with "kubectl: OK"
+```🧰 Tools
🪛 Markdownlint
72-72: null
Spaces inside emphasis markers
(MD037, no-space-in-emphasis)
| ## Kind K8s Installation | ||
| ### Install Kind | ||
| Download and install **kind** k8s | ||
| * Download kind binary with curl on Linux | ||
| ```bash | ||
| [ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64 | ||
| ``` | ||
| * Install kind | ||
| ```bash | ||
| chmod +x ./kind | ||
| sudo mv ./kind /usr/local/bin/kind | ||
| ``` | ||
| * Run `kind` to verify if its installed | ||
|
|
||
|  | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add support for ARM64 architecture
AWS offers Graviton (ARM64) instances which can be more cost-effective. Add support for ARM64 architecture.
Download and install **kind** k8s
* Download kind binary with curl on Linux
```bash
- [ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64
+ ARCH=$(uname -m)
+ case $ARCH in
+ x86_64)
+ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64
+ ;;
+ aarch64)
+ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-arm64
+ ;;
+ *)
+ echo "Unsupported architecture: $ARCH"
+ exit 1
+ ;;
+ esac
<!-- This is an auto-generated comment by CodeRabbit -->
| ## Kind K8s Usage | ||
| ### Create a Cluster | ||
| Create a Kubernetes Cluster using `kind create cluster`. Use the `--name` flag to provide a cluster name. For Example, `kind create cluster --name=<cluster-name>` (Replace `<cluster-name>` with desired cluster name). | ||
|
|
||
|  | ||
|
|
||
| ### Interacting with Clusters | ||
| `kubectl` can be used to interact with created clusters. | ||
|
|
||
| * To list all the clusters, execute `kind get clusters` | ||
|
|
||
|  | ||
|
|
||
| * To get nodes, run `kubectl get nodes` | ||
|
|
||
|  | ||
|
|
||
| ### Optional: Delete cluster | ||
| Delete a Kubernetes Cluster using `kind delete cluster`. Use the `--name` flag to provide a cluster name. For Example, `kind delete cluster --name=<cluster-name>` (Replace `<cluster-name>` with desired cluster name). | ||
|
|
||
|  | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Expand cluster management section
Add essential cluster management topics:
- Cluster configuration using YAML
- Multi-node cluster setup
- Resource limits configuration
- Persistent storage setup
- Ingress configuration
- Common troubleshooting steps
## Kind K8s Usage
+
+### Cluster Configuration
+Create a config file `kind-config.yaml`:
+```yaml
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+- role: control-plane
+ extraPortMappings:
+ - containerPort: 80
+ hostPort: 80
+- role: worker
+- role: worker
+```
+
+Create cluster with config:
+```bash
+kind create cluster --config kind-config.yaml
+```
+
+### Storage Setup
+Apply local storage class:
+```bash
+kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
+```
+
+### Troubleshooting
+Common issues and solutions:
+- Check logs: `kubectl logs -n kube-system kube-controller-manager-kind-control-plane`
+- Check events: `kubectl get events --all-namespaces`
+- Resource constraints: `kubectl describe node`| ## Pre-requisites | ||
| * AWS EC2 (Ubuntu) | ||
| * Docker | ||
| * kubectl | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Expand prerequisites section
Add essential prerequisites for a complete setup:
- Minimum storage requirements
- Required open ports in security group
- SSH key pair for EC2 access
- IAM permissions needed
## Pre-requisites
* AWS EC2 (Ubuntu)
+* AWS Account with appropriate IAM permissions
+* SSH key pair for EC2 access
+* Security Group with following ports open:
+ * SSH (22)
+ * Container ports (30000-32767) for NodePort services
* Docker
* kubectl
+* Minimum 15GB storage📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## Pre-requisites | |
| * AWS EC2 (Ubuntu) | |
| * Docker | |
| * kubectl | |
| ## Pre-requisites | |
| * AWS EC2 (Ubuntu) | |
| * AWS Account with appropriate IAM permissions | |
| * SSH key pair for EC2 access | |
| * Security Group with following ports open: | |
| * SSH (22) | |
| * Container ports (30000-32767) for NodePort services | |
| * Docker | |
| * kubectl | |
| * Minimum 15GB storage |
Created a Markdown file
kind_ec2_installation.mdwhich is an installation guide for kind k8s on AWS EC2 using ubuntu.Summary by CodeRabbit