{"id":16797154,"url":"https://github.com/jdockerty/go-docker-k8s","last_synced_at":"2025-07-21T20:31:48.565Z","repository":{"id":115786785,"uuid":"232422301","full_name":"jdockerty/go-docker-k8s","owner":"jdockerty","description":"A small and simple personal project for using Golang, Docker, and Kubernetes.","archived":false,"fork":false,"pushed_at":"2020-01-11T13:35:40.000Z","size":153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-17T21:28:30.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdockerty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-07T21:38:49.000Z","updated_at":"2024-06-19T08:57:21.169Z","dependencies_parsed_at":null,"dependency_job_id":"0ca3ffab-2c49-4f3d-a217-8c8dd7bd3e8e","html_url":"https://github.com/jdockerty/go-docker-k8s","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jdockerty/go-docker-k8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fgo-docker-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fgo-docker-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fgo-docker-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fgo-docker-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdockerty","download_url":"https://codeload.github.com/jdockerty/go-docker-k8s/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdockerty%2Fgo-docker-k8s/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266375253,"owners_count":23919545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T09:21:17.758Z","updated_at":"2025-07-21T20:31:48.548Z","avatar_url":"https://github.com/jdockerty.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Task Scheduler Dashboard\n\nSmall personal project for using Golang, Docker, and Kubernetes. Tutorial by [callicoder](https://www.callicoder.com/deploy-containerized-go-app-kubernetes/)\n\n### Notes\n\n### Docker\n\nDockerfile is commented to provide explanation of each layer.\n\nStarting with the command `docker build -t gokubedash .`  \n\nThis builds the image using the Dockerfile, whilst tagging it as _'gokubedash'_, everything from the current directory, which is not part of the .dockerignore, is included in the image. \n\n\nThe resulting image was then tagged with _jdockerty/gokubedash:1.1_ as this provides the _jdockerty/_ namespace in a DockerHub. _(This may not have been entirely necessary upon reflection, as you can add multiple tags in the previous step.)_   \n`docker tag gokubedash jdockerty/gokubedash:1.1`  \n\n\nThe image was then run as a container to test that it was functioning properly. This maps the localhost (127.0.0.1) port 8080, to the port which is exposed from the container, which is also 8080. `docker run -p 127.0.0.1:8080:8080 gokubedash`\n\nAfter this, I pushed the image to DockerHub for use with Kubernetes. `docker push jdockerty/gokubedash:1.1`\n\n### Kubernetes\nBeforehand, I had to install [Kubernetes](https://kubernetes.io/docs/tasks/tools/install-kubectl/) and [Minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/). Kubernetes is for running containers at scale and Minikube is so that a Kubernetes cluster can be run locally.\n\nThe process begins with `minikube start`\n\nA YAML file, known as a manifest, is used to start Kubernetes deployments. This is the _k8sconfig.yml_ file.\n\nTo begin the K8s deployment, we issue the command `kubectl apply -f k8sconfig.yml`, the -f flag is used to denote the file we are using for our deployment's configuration. This applies our resources, the deployment and a service.\n\nWe can see the deployments using the command `kubectl get deployments`, of which the output shown below.\n![Get deployments K8s command](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/get%20deployments.png)\n\nThe pods can also be seen using the command `kubectl get pods`.\n![Get pods K8s command](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/get%20pods.png)\n\nSince the pods within the cluster cannot be accessed from outside, by default, we must port-forward one of the pods to test it is working. `kubectl port-forward gokubedash-6bf64bdc89-4r89s 8080:8080`\n\n![Port forwarding K8s](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/port%20forward.png)\n\nWe can then visit localhost:8080 to test whether it is working properly.\n![Testing K8s port forward](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/port%20forward%20testing.png)\n\nKubernetes allows for very fast scaling, we increase the number of pods that are running by issuing the command \n\n`kubectl scale --replicas=5 deployment/gokubedash` \n\nWe initial set the number of pods (replicas) to 3, so now we are scaling it to 5 with a single command.\n\n![Scaling K8s](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/scaling%20k8.png)\n\n### Elastic Kubernetes Service (Amazon EKS)\n_This side implementation was done out of interest from using EKS within AWS and wasn't part of the original tutorial post. This was done through AWS documentation and [this post](https://codeburst.io/getting-started-with-kubernetes-deploy-a-docker-container-with-kubernetes-in-5-minutes-eb4be0e96370)_\n\nFirstly, the Docker image we have for our _gokubedash_ was uploaded into AWS Elastic Container Registry (ECR). We have to log into ECR before we can do this, the credentials are provided using the command, the ECR registry had been created prior to this. `aws ecr get-login --no-include-email --region eu-west-2`\n\nThe output of this command is then used to log into the ECR registry \n\n`docker login -u AWS -p \u003cpassword output from previous command\u003e \u003cECR domain\u003e`\n\nFrom here we simply tag the current image we were using and then push it into ECR.\n\n`docker tag jdockerty/go-k8s:latest \u003cECR domain\u003e/gokubedash:latest`\n\n`docker push \u003cECR domain\u003e/gokubedash:latest`\n\nWe created the EKS cluster and node group on AWS. This was done through following the [getting started guide](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-console.html) and Management Console prompts.\n\n![EKS Cluster console](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/EKS%20cluster.png)\n\nFrom there, we must update the EKS cluster with the AWS CLI, this was done through the command \n\n`aws eks --region eu-west-2 update-kubeconfig --name NewCluster` \n\nThis updated the EKS cluster with the k8sconfig.yml we had on our local machine.\n\nFrom there we simply need to run the command \n\n`kubectl run gokubedash --image=\u003cECR domain\u003e/gokubedash:latest --port=8080`\n\nThis runs our application, under the name gokubedash, using the image provided inside of ECR, on port 8080, which is the port exposed through the Go code.\n\nFrom here we can issue `kubectl get pods` to see the running pods.\n\n![EKS Get pods](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/get%20nodes%20EKS.png)\n\nSince we know that the deployment cannot be accessed from outside yet, as the pods are given private addresses within a cluster, it must be exposed to the outside world using a load balancer. This can be achieved with the command\n\n`kubectl expose deployment gokubedash --type=LoadBalancer --port=8080 --target-port=8080 `\n\nThis exposes our deployment with the load balancer listening on port 8080, forwarding the traffic to 8080 as well, which is what our application is listening on for connections.\n\nThe load balancer is given an external address for us to access, we can see this by using the command \n\n`kubectl get svc`\n\n![EKS kubectl get svc](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/EKS%20get%20svc.png)\n\nWe can then browse to the provided external domain on port 8080 and view our application from one of the pods.\n\n![EKS app working](https://github.com/jdockerty/taskschedulerdashboard/blob/master/k8simages/EKS%20app%20working.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdockerty%2Fgo-docker-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdockerty%2Fgo-docker-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdockerty%2Fgo-docker-k8s/lists"}