-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b4629b
commit 146d7c3
Showing
2 changed files
with
192 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,155 @@ | ||
# Local Development Environment Setup | ||
|
||
This guide will help you set up your local development environment for the SUSE Telemetry Gateway service. | ||
|
||
## Setting up k3s | ||
|
||
1. Navigate to the `k3s` directory: | ||
```sh | ||
cd k3s | ||
``` | ||
2. Run the `k3s-init.sh` script to install and start k3s: | ||
```sh | ||
./k3s-init.sh | ||
``` | ||
|
||
## Deploying PostgreSQL | ||
|
||
1. Navigate to the `charts/postgres` directory: | ||
```sh | ||
cd ../charts/postgres | ||
``` | ||
2. Deploy PostgreSQL using Helm: | ||
```sh | ||
helm install postgres . -n telemetry --create-namespace | ||
``` | ||
|
||
## Deploying Telemetry Server | ||
|
||
1. Navigate to the `charts/telemetry-server` directory: | ||
```sh | ||
cd ../telemetry-server | ||
``` | ||
2. Deploy Telemetry Server using Helm: | ||
```sh | ||
helm install telemetry-server . -n telemetry | ||
``` | ||
|
||
## Debugging | ||
|
||
### Checking Pods | ||
|
||
1. Get the list of pods: | ||
```sh | ||
kubectl get pods -n telemetry | ||
``` | ||
|
||
2. Check the status of the PostgreSQL pod: | ||
```sh | ||
kubectl get pod -l app=postgres -n telemetry | ||
``` | ||
|
||
3. Check the status of the Telemetry Server pod: | ||
```sh | ||
kubectl get pod -l app=telemetry-server -n telemetry | ||
``` | ||
|
||
### Checking Services | ||
|
||
1. Get the list of services: | ||
```sh | ||
kubectl get svc -n telemetry | ||
``` | ||
|
||
### Logs and Descriptions | ||
|
||
1. Check the logs of the PostgreSQL pod: | ||
```sh | ||
kubectl logs -l app=postgres -n telemetry | ||
``` | ||
|
||
2. Check the logs of the Telemetry Server pod: | ||
```sh | ||
kubectl logs -l app=telemetry-server -n telemetry | ||
``` | ||
|
||
3. Describe the PostgreSQL pod for more details: | ||
```sh | ||
kubectl describe pod -l app=postgres -n telemetry | ||
``` | ||
|
||
4. Describe the Telemetry Server pod for more details: | ||
```sh | ||
kubectl describe pod -l app=telemetry-server -n telemetry | ||
``` | ||
|
||
## Cleaning Up | ||
|
||
To clean up your local development environment: | ||
|
||
1. Delete the Helm releases: | ||
```sh | ||
helm uninstall telemetry-server -n telemetry | ||
helm uninstall postgres -n telemetry | ||
``` | ||
|
||
2. Delete the k3s cluster: | ||
```sh | ||
/usr/local/bin/k3s-uninstall.sh | ||
``` | ||
|
||
3. Remove the local mounted volumes: | ||
```sh | ||
sudo rm -rf /mnt/data | ||
``` | ||
|
||
|
||
## Stopping k3s | ||
|
||
If you wish to stop k3s instead of completely uninstalling it run: | ||
|
||
```sh | ||
/usr/local/bin/k3s-killall.sh | ||
``` | ||
## Restarting k3s | ||
|
||
To restart k3s, run the following commands: | ||
|
||
1. Start k3s service: | ||
```sh | ||
sudo systemctl start k3s | ||
``` | ||
|
||
2. Start k3s-agent service: | ||
```sh | ||
sudo systemctl start k3s-agent | ||
``` | ||
|
||
## Testing | ||
|
||
Once the deployments are up and running, you can test the Telemetry Server by port-forwarding the telemetry-server pod. | ||
|
||
1. **Port Forward the Telemetry Server Pod:** | ||
|
||
First, identify the Telemetry Server pod name: | ||
```sh | ||
kubectl get pods -n telemetry -l app=telemetry-server | ||
``` | ||
|
||
Use the pod name to set up port forwarding: | ||
```sh | ||
kubectl port-forward -n telemetry <telemetry-server-pod-name> 8080:8080 | ||
``` | ||
|
||
This command forwards port 8080 on your local machine to port 8080 on the Telemetry Server pod. | ||
|
||
2. Follow the steps on telemetry-server README.md as usual. | ||
|
||
By following these steps, you can confirm that the Telemetry Server is operational and capable of handling requests. | ||
|
||
## Notes | ||
|
||
- This is a local k3s installation for test purposes. Changing permissions for k3s kubeconfig files is not recommended for production environments. | ||
- Update the Helm values as necessary in the `values.yaml` files for both PostgreSQL and Telemetry Server before deploying. | ||
|
||
By following these steps, you should have a local k3s cluster running with PostgreSQL and Telemetry Server deployed. |
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,37 @@ | ||
#!/bin/bash | ||
|
||
# Check k3s installation | ||
k3s_path=$(which k3s) | ||
if [ -x "$k3s_path" ]; then | ||
echo "k3s is already installed" | ||
exit 0 | ||
fi | ||
|
||
# Install k3s | ||
$ curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - | ||
|
||
K3S_KUBECONFIG=/etc/rancher/k3s/k3s.yaml | ||
|
||
# Check if kubectl is installed | ||
echo "Checking if kubectl is in PATH..." | ||
kubectl_path=$(which kubectl) | ||
if [ -x "$kubectl_path" ]; then | ||
echo "kubectl is installed, merging kubeconfig files..." | ||
|
||
# Backup the existing kubeconfig file if it exists | ||
if [ -f ~/.kube/config ]; then | ||
KUBECONFIG_BACKUP=~/.kube/config.backup | ||
cp ~/.kube/config $KUBECONFIG_BACKUP | ||
echo "Existing kubeconfig backed up to $KUBECONFIG_BACKUP" | ||
fi | ||
|
||
# Merge kubeconfig files | ||
env KUBECONFIG=~/.kube/config:$K3S_KUBECONFIG kubectl config view --merge --flatten > /tmp/config | ||
mv /tmp/config ~/.kube/config | ||
kubectl config rename-context default k3s | ||
echo "kubeconfig files merged successfully" | ||
else | ||
echo "kubectl is not installed, skipping kubeconfig merge, use k3s kubectl" | ||
fi | ||
|
||
echo "k3s installation and configuration completed successfully" |