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

feat: Add documentation about busola in k8s and adjust k8s configs #3547

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 15 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
IMG_NAME = busola-web
LOCAL_IMG_NAME = busola
IMG = $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(IMG_NAME)
LOCAL_IMG = $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(LOCAL_IMG_NAME)
KYMA_DASHBOARD_IMG = $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(KYMA_DASHBOARD_IMG_NAME)
TAG = $(DOCKER_TAG)
APP_NAME = busola
.DEFAULT_GOAL=help

help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)


.PHONY: resolve
resolve:
Expand All @@ -21,30 +21,12 @@ release: build-image push-image

release-local: build-image-local push-image-local

build-image:
docker build -t $(IMG_NAME) -f Dockerfile .

build-image-local:
docker build -t $(LOCAL_IMG_NAME) -f Dockerfile.local .

push-image:
docker tag $(IMG_NAME) $(IMG):$(TAG)
docker push $(IMG):$(TAG)
ifeq ($(JOB_TYPE), postsubmit)
@echo "Sign image with Cosign"
cosign version
cosign sign -key ${KMS_KEY_URL} $(REPO)$(IMG):$(TAG)
else
@echo "Image signing skipped"
endif

push-image-local:
docker tag $(LOCAL_IMG_NAME) $(LOCAL_IMG):$(TAG)
docker push $(LOCAL_IMG):$(TAG)
ifeq ($(JOB_TYPE), postsubmit)
@echo "Tag image with latest"
docker tag $(LOCAL_IMG_NAME) $(LOCAL_IMG):latest
docker push $(LOCAL_IMG):latest
else
@echo "Image tagging with latest skipped"
endif
build-image: ## Build busola backend image
docker build -t $(APP_NAME) -f Dockerfile .

install-busola: build-image ## Build busola web image and install it on local k3d cluster
$(eval HASH_TAG=$(shell docker images $(APP_NAME):latest --quiet))
docker tag $(APP_NAME) $(APP_NAME):$(HASH_TAG)

k3d image import $(APP_NAME):$(HASH_TAG) -c kyma
kubectl set image deployment busola busola=$(APP_NAME):$(HASH_TAG)
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,78 @@ For the information on how to run tests and configure them, go to the [`tests`](
docker run --rm -it -p 3001:3001 -v <path to your custom config>:/app/core-ui/environments/ --env ENVIRONMENT={your-env} --pid=host --name busola europe-docker.pkg.dev/kyma-project/prod/busola:latest
```

## Deploy Busola in Kubernetes Cluster
dbadura marked this conversation as resolved.
Show resolved Hide resolved

To install Busola on Kubernetes cluster run:
dbadura marked this conversation as resolved.
Show resolved Hide resolved

```shell
(cd resources && kustomize build base/ | kubectl apply -f- )
```

To install Busola using specific environment configuration, set `ENVIRONMENT` shell environment variable and run:
dbadura marked this conversation as resolved.
Show resolved Hide resolved

```shell
(cd resources && kustomize build environments/${ENVIRONMENT} | kubectl apply -f- )
```

## Access Busola installed on Kubernetes
dbadura marked this conversation as resolved.
Show resolved Hide resolved

### Kubectl
dbadura marked this conversation as resolved.
Show resolved Hide resolved

The simplest method which always works is to use capabilities of `kubectl`.
dbadura marked this conversation as resolved.
Show resolved Hide resolved

```shell
kubectl port-forward services/busola 3001:3001
```

### Busola installed on K3d
dbadura marked this conversation as resolved.
Show resolved Hide resolved

Prerequisites:

- K3d with installed Traefik, by default it's installed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- K3d with installed Traefik, by default it's installed.
- k3d with [Traefik](https://k3d.io/v5.6.0/usage/k3s/#traefik) (installed by default).


Install ingress resources by running:
dbadura marked this conversation as resolved.
Show resolved Hide resolved

```shell
(cd resources && kubectl apply -f ingress/ingress.yaml)
```

Go to `localhost`
Copy link
Contributor

Choose a reason for hiding this comment

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

What port? Provide a command to create k3d cluster with load balancer port mapping, e.g.

k3d cluster create -p "80:80@loadbalancer"

Otherwise, the port is not exposed in the host machine (at least on mac os)

dbadura marked this conversation as resolved.
Show resolved Hide resolved

#### Connect to the k3d cluster where Busola is installed.
dbadura marked this conversation as resolved.
Show resolved Hide resolved

To be able to connect to the same K3d cluster where Busola is installed.
dbadura marked this conversation as resolved.
Show resolved Hide resolved
Download kubeconfig and change cluster server address to `https://kubernetes.default.svc:443`.
dbadura marked this conversation as resolved.
Show resolved Hide resolved

Using shell:
Set `K3D_CLUSTER_NAME` shell environment variable to name of your cluster.

```shell
k3d kubeconfig get ${K3D_CLUSTER_NAME} > k3d-kubeconfig.yaml
yq --inplace '.clusters[].cluster.server = "https://kubernetes.default.svc:443"' k3d-kubeconfig.yaml
pbochynski marked this conversation as resolved.
Show resolved Hide resolved
```

### Kubernetes cluster with Istio installed
dbadura marked this conversation as resolved.
Show resolved Hide resolved

Prerequisites:

- Sidecar Proxy injection enabled, see [Kyma docs](https://kyma-project.io/#/istio/user/tutorials/01-40-enable-sidecar-injection?id=enable-istio-sidecar-proxy-injection), how to enable it.
dbadura marked this conversation as resolved.
Show resolved Hide resolved
- Api gateway module installed, see [install docs](https://kyma-project.io/#/02-get-started/01-quick-install)
dbadura marked this conversation as resolved.
Show resolved Hide resolved

Install Istio needed resources by running:
dbadura marked this conversation as resolved.
Show resolved Hide resolved

```shell
(cd resources && kubectl apply -k istio)
```

To get Busola address run:
dbadura marked this conversation as resolved.
Show resolved Hide resolved

```shell
kubectl get virtualservices.networking.istio.io
```

and find `busola-***` virtual service. Under `HOSTS` there is address to access Busola page.
dbadura marked this conversation as resolved.
Show resolved Hide resolved

## Troubleshooting

> **TIP:** To solve most of the problems with Busola development, clear the browser cache or do a hard refresh of the website.
Expand Down
18 changes: 6 additions & 12 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
APP_NAME = busola-backend
IMG_NAME := $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(APP_NAME)
TAG := $(DOCKER_TAG)


build-image:
docker build -t $(APP_NAME) -f Dockerfile .
push-image:
docker tag $(APP_NAME):latest $(IMG_NAME):$(TAG)
docker push $(IMG_NAME):$(TAG)

release: build-image push-image
##@ General
.DEFAULT_GOAL=help
.PHONY: help
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
18 changes: 0 additions & 18 deletions resources/apply-resources-istio.sh

This file was deleted.

22 changes: 0 additions & 22 deletions resources/apply-resources.sh

This file was deleted.

53 changes: 0 additions & 53 deletions resources/base/backend/deployment.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions resources/base/backend/hpa.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions resources/base/backend/service.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
name: busola
labels:
app: busola
spec:
Expand All @@ -16,27 +16,28 @@ spec:
spec:
containers:
- name: busola
image: busola-web
imagePullPolicy: Always
image: busola
imagePullPolicy: IfNotPresent
env:
- name: ENVIRONMENT
valueFrom:
configMapKeyRef:
optional: true
key: ENVIRONMENT
name: environment
volumeMounts:
- name: config
mountPath: /app/core-ui/config
resources:
requests:
cpu: 100m
memory: 21Mi
ports:
- containerPort: 8080
volumeMounts:
- name: config
mountPath: /app/core-ui/config
- containerPort: 3001
volumes:
- name: config
configMap:
optional: true
name: busola-config
items:
- key: config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web
name: busola
labels:
app: busola
spec:
pbochynski marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: web
name: busola
labels:
app: busola
spec:
ports:
- port: 8080
name: http-web
targetPort: 8080
- port: 3001
name: http-busola
targetPort: 3001
selector:
app: busola

This file was deleted.

14 changes: 0 additions & 14 deletions resources/base/extensions-patch/kustomization.yaml

This file was deleted.

Loading
Loading