Skip to content

TennyV/K8sCline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLine - Simple Go Webserver for Kubernetes

A simple Go webserver designed to be deployed on Kubernetes.

Local Development

Prerequisites

  • Go 1.21 or later
  • Docker
  • kubectl
  • Access to a Kubernetes cluster

Running Locally

To run the server locally:

go run main.go

The server will start on port 8080 by default. You can access it at http://localhost:8080

Testing the Server

You can test the server using curl:

curl http://localhost:8080

Docker Build and Push

  1. Build the Docker image:
docker build -t your-registry/cline-server:latest .
  1. Push the Docker image to your registry:
docker push your-registry/cline-server:latest

Kubernetes Deployment

Update Image Registry

Before deploying, update the Docker registry in the deployment file:

# Replace ${DOCKER_REGISTRY} with your actual registry
sed -i 's|${DOCKER_REGISTRY}|your-registry|g' k8s/deployment.yaml

Deploy to Kubernetes

  1. Apply the Kubernetes manifests:
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
  1. Check the deployment status:
kubectl get deployments
kubectl get pods
kubectl get services
kubectl get ingress

Accessing the Application

If you're using the provided Ingress configuration, update your DNS or hosts file to point cline-server.example.com to your Kubernetes cluster's ingress controller IP.

For local testing with minikube, you can use port-forwarding:

kubectl port-forward svc/cline-server 8080:80

Then access the application at http://localhost:8080

Configuration

The application can be configured using environment variables:

  • PORT: The port the server listens on (default: 8080)

Scaling

You can scale the deployment by changing the replicas value in k8s/deployment.yaml or by using the kubectl scale command:

kubectl scale deployment cline-server --replicas=3

About

Kubernets with cline

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors