-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nginx as an example instead of lensappiq (#45)
* add nginx as an example instead of lensappiq * update the link to the blueprint * review comment
- Loading branch information
1 parent
efdbb48
commit 0bb04fa
Showing
4 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: boundless.mirantis.com/v1alpha1 | ||
kind: Blueprint | ||
metadata: | ||
name: kind-cluster | ||
spec: | ||
kubernetes: | ||
provider: kind | ||
components: | ||
addons: | ||
- name: example-server | ||
kind: chart | ||
enabled: true | ||
namespace: default | ||
chart: | ||
name: nginx | ||
repo: https://charts.bitnami.com/bitnami | ||
version: 15.1.1 | ||
values: | | ||
service: | ||
type: ClusterIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: "Nginx with k0s on a VM" | ||
draft: false | ||
--- | ||
|
||
This example shows how use boundless to create a single node k0s cluster using a local VM and install [Nginx](https://artifacthub.io/packages/helm/bitnami/nginx) on it. | ||
|
||
Popular VMs include | ||
|
||
- [lima VM](https://github.com/lima-vm/lima) | ||
- [multipass VM](https://multipass.run/) | ||
|
||
Any type of VM can be used to run boundless. If you choose to use another type of VM, you will need to locate the VM's IP address, username, SSH port, and SSH credentials. This example uses a lima VM. | ||
|
||
#### Prerequisites | ||
|
||
Along with `boundless` CLI, the following tools will also be required: | ||
|
||
- [k0sctl](https://github.com/k0sproject/k0sctl#installation) - required for installing a k0s distribution | ||
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) - used to forward ports to the cluster | ||
|
||
#### Creating the VM | ||
|
||
Start a Lima VM by running `limactl start`. Refer the [Lima documentation](https://github.com/lima-vm/lima#getting-started) for more information. | ||
|
||
#### Setting up the blueprint | ||
|
||
Download a copy of the [example Nginx on k0s blueprint](https://raw.githubusercontent.com/mirantiscontainers/boundless/main/blueprints/k0s-example/k0s-example.yaml). | ||
|
||
Modify the blueprint so that the `spec.kubernetes.infra.hosts` section matches your VM's IP address, username, SSH port, and SSH credentials. The values can be passed as environment variables or replaced with your own values. For example, if you are using a Lima VM, the section should look like this: | ||
|
||
```yaml | ||
hosts: | ||
- ssh: | ||
address: 127.0.0.1 # Change this to your VM's IP address | ||
keyPath: $HOME/.lima/_config/${USER} # Change this to your VM's key path | ||
port: 60022 # Change this to your VM's SSH port | ||
user: $USER # Change this to your VM's username | ||
role: single | ||
``` | ||
You can also modify the `spec.components.addons.chart.values` section. For complete configuration options, see the [Nginx documentation](https://artifacthub.io/packages/helm/bitnami/nginx). | ||
|
||
#### Apply the blueprint | ||
|
||
Apply the blueprint using using `bctl`: | ||
|
||
```shell | ||
bctl apply -f k0s-example.yaml | ||
``` | ||
|
||
It will take a few moments before the Nginx pods are ready. You can monitor the progress with: | ||
|
||
```shell | ||
kubectl get pods -w | ||
``` | ||
|
||
#### Cleanup | ||
|
||
To remove the cluster, run: | ||
|
||
```shell | ||
bctl reset -f k0s-example.yaml | ||
``` | ||
|
||
This will remove all resources created by the blueprint but leave the k0s cluster. |
84 changes: 84 additions & 0 deletions
84
website/content/docs/examples/nginx-in-k0s-with-tf-and-aws.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
title: "Nginx with k0s, Terraform, and AWS" | ||
draft: false | ||
--- | ||
|
||
Bootstrap a k0s cluster in AWs with terraform and install Nginx. | ||
|
||
#### Pre-requisite | ||
|
||
Along with `boundless` CLI, the following tools will also be required: | ||
|
||
- [AWS](https://aws.amazon.com/cli/) - used to create VMs for running the cluster | ||
- [terraform](https://www.terraform.io/) - used setup VMs in AWS | ||
- [k0sctl](https://github.com/k0sproject/k0sctl#installation) - required for installing a k0s distribution | ||
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) - used to forward ports to the cluster | ||
|
||
#### Setting up VMs in AWS | ||
|
||
Refer to the [example Terraform scripts](https://github.com/mirantiscontainers/boundless/tree/main/terraform/k0s-in-aws) for creating VMs in AWS. | ||
|
||
1. Change to the directory containing the Terraform scripts. | ||
2. Copy the `terraform.tfvars.example` to `terraform.tfvars` and change the content to be similar to: | ||
``` | ||
cluster_name = "example-boundless" | ||
controller_count = 1 | ||
worker_count = 1 | ||
cluster_flavor = "m5.large" | ||
``` | ||
3. `terraform init` | ||
4. `terraform apply` | ||
5. `terraform output --raw bop_cluster > ./VMs.yaml` | ||
|
||
#### Setting up the blueprint | ||
|
||
Download the [example blueprint](https://raw.githubusercontent.com/mirantiscontainers/boundless/main/blueprints/k0s-in-aws-with-tf/k0s-in-aws-with-tf.yaml) for Nginx. | ||
|
||
Modify the blueprint so that the `spec.kubernetes.infra.hosts` section matches your AWS VMs' IP address, username, SSH port, and SSH credentials. The values can be passed as environment variables or replaced with your own values. For example, the hosts section should match the output from `terraform output --raw bop_cluster`. For example: | ||
|
||
```yaml | ||
spec: | ||
kubernetes: | ||
provider: k0s | ||
version: 1.27.4+k0s.0 | ||
infra: | ||
hosts: | ||
- ssh: | ||
address: 52.91.89.114 | ||
keyPath: ./example/aws-tf/aws_private.pem | ||
port: 22 | ||
user: ubuntu | ||
role: controller | ||
- ssh: | ||
address: 10.0.0.2 | ||
keyPath: ./example/aws-tf/aws_private.pem | ||
port: 22 | ||
user: ubuntu | ||
role: worker | ||
``` | ||
You can also modify the `spec.components.addons.chart.values` section. For complete configuration options, see the [Nginx documentation](https://artifacthub.io/packages/helm/bitnami/nginx). | ||
|
||
#### Apply the blueprint | ||
|
||
Apply the blueprint using using `bctl`: | ||
|
||
```shell | ||
bctl apply -f k0s-in-aws-with-tf.yaml | ||
``` | ||
|
||
It will take a few moments before the Nginx pods are ready. You can monitor the progress with: | ||
|
||
```shell | ||
kubectl get pods -w | ||
``` | ||
|
||
#### Cleanup | ||
|
||
To remove the cluster, run: | ||
|
||
```shell | ||
bctl reset -f k0s-in-aws-with-tf.yaml | ||
``` | ||
|
||
This will remove all resources created by the blueprint but leave the k0s cluster. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: "Nginx in Kind" | ||
draft: false | ||
--- | ||
|
||
This blueprint bootstraps a kind cluster and installs Nginx. This is only a basic setup. For complete configuration options, see the [Nginx documentation](https://artifacthub.io/packages/helm/bitnami/nginx). | ||
|
||
#### Prerequisites | ||
|
||
Along with `boundless` CLI, the following tools will also be required: | ||
|
||
- [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) - required for installing a kind distribution | ||
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) - used to forward ports to the cluster | ||
|
||
#### Setting up the blueprint | ||
|
||
The [example blueprint](https://raw.githubusercontent.com/mirantiscontainers/boundless/main/blueprints/kind-example/kind-example.yaml) for Nginx will bootstrap a `kind` cluster, install `Boundless Operator`, and install Nginx as an addon in the cluster. | ||
|
||
The blueprint can be modified for your setup. Change the `spec.components.addons.chart.values` section to set your own values. | ||
|
||
#### Apply the blueprint | ||
|
||
Once modified, apply the blueprint with `bctl`: | ||
|
||
```shell | ||
bctl apply -f kind-example.yaml | ||
``` | ||
|
||
It should print following output to the terminal: | ||
|
||
```shell | ||
INF Applying blueprint kind-example.yaml | ||
Creating cluster "kind-cluster" ... | ||
✓ Ensuring node image (kindest/node:v1.27.3) 🖼 | ||
✓ Preparing nodes 📦 | ||
✓ Writing configuration 📜 | ||
✓ Starting control-plane 🕹️ | ||
✓ Installing CNI 🔌 | ||
✓ Installing StorageClass 💾 | ||
Set kubectl context to "kind-kind-cluster" | ||
You can now use your cluster with: | ||
|
||
kubectl cluster-info --context kind-kind-cluster | ||
|
||
Have a nice day! 👋 | ||
INF Waiting for nodes to be ready | ||
INF Installing Boundless Operator | ||
INF Waiting for all pods to be ready | ||
INF Applying Boundless Operator resource | ||
INF Applying Blueprint | ||
INF Finished installing Boundless Operator | ||
``` | ||
|
||
It will take a few moments before the Nginx pods are ready. You can check the status. | ||
|
||
```shell | ||
kubectl get pods -w | ||
``` | ||
|
||
#### Cleanup | ||
|
||
To remove the cluster, run: | ||
|
||
```shell | ||
bctl reset -f kind-example.yaml | ||
``` | ||
|
||
This will remove the cluster and all resources created by the blueprint. |