Skip to content

appsignal/kubetest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes test setup

Barebones Ruby on Kubernetes test setup. Mostly following the instructions in https://kubernetes-rails.com

Build the image:

docker build --build-arg revision=$(git rev-parse HEAD) -t appsignal/kubetest:latest .

Then run it and check that it works:

docker run -p 4567:4567 appsignal/kubetest:latest

If this works you can push the image:

docker push appsignal/kubetest:latest

And run a cluster, if kubernetes is on on your local docker instance:

kubectl apply -f k8s

Check that everything is running:

kubectl get pods

And you can now open the app on http://localhost:4567.

To delete the deployment run:

kubectl delete -f k8s

To deploy the latest version of the image:

kubectl rollout restart deployment.apps/kubetest-deployment

Terraform Deployment (Alternative)

As an alternative to manual kubectl commands, you can use Terraform to manage the deployment:

cd terraform
terraform init
terraform apply

The app will be available at http://localhost:4567

For full documentation including configuration options, see terraform/README.md.

To tear down the infrastructure:

terraform destroy

Console access

To prod around with bash get a pod name (kubetest-deployment-7ddc65cb8b-zcrhd, for example):

kubectl get pod -o wide

NAME                                   READY   STATUS    RESTARTS   AGE     IP         NODE             NOMINATED NODE   READINESS GATES
kubetest-deployment-7ddc65cb8b-zcrhd   1/1     Running   0          5m19s   10.1.0.6   docker-desktop   <none>           <none>

And run:

kubectl exec -it kubetest-deployment-7ddc65cb8b-zcrhd -- bash

Logs

To tail the logs for a pod:

kubectl logs kubetest-deployment-7ddc65cb8b-zcrhd --follow

About

Test app to test kubernetes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •