{"id":30754261,"url":"https://github.com/twogg-git/k8s-intro","last_synced_at":"2026-06-29T07:31:18.355Z","repository":{"id":83441735,"uuid":"123304136","full_name":"twogg-git/k8s-intro","owner":"twogg-git","description":"Useful beginners intro to Kubernetes","archived":false,"fork":false,"pushed_at":"2018-04-09T01:45:39.000Z","size":158,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-04T09:31:11.044Z","etag":null,"topics":["dockerhub-image","golang","katacoda","kubernetes"],"latest_commit_sha":null,"homepage":null,"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/twogg-git.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-02-28T15:29:29.000Z","updated_at":"2018-09-24T22:05:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6970505-cfd5-4263-bf29-2c2bf8e41511","html_url":"https://github.com/twogg-git/k8s-intro","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/twogg-git/k8s-intro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogg-git%2Fk8s-intro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogg-git%2Fk8s-intro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogg-git%2Fk8s-intro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogg-git%2Fk8s-intro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twogg-git","download_url":"https://codeload.github.com/twogg-git/k8s-intro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogg-git%2Fk8s-intro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34918101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["dockerhub-image","golang","katacoda","kubernetes"],"created_at":"2025-09-04T09:07:47.566Z","updated_at":"2026-06-29T07:31:18.350Z","avatar_url":"https://github.com/twogg-git.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![header](https://raw.githubusercontent.com/twogg-git/k8s-intro/master/kubernetes_katacoda.png)\n\n\n**Note:** To follow this tutorial we are going to use [Katacoda Single-Node-Cluster](https://www.katacoda.com/courses/kubernetes/launch-single-node-cluster) an online Kubernetes-Minikube playground. If you want to try this exercices locally, here is [Minikube](https://github.com/kubernetes/minikube/) setup link.\n\n## Start a Kubernetes cluster with Minukube\n\nWe are going to use Minikube to deploy Kubernetes locally. It comes with support for a variety of hypervisors, including VirtualBox, VMware Fusion, KVM, and xhyve, and OSs, including OSX, Windows, and Linux.\n\nThe Minikube CLI can be used to start, stop, delete, obtain status, and perform other actions on the virtual machine. \n\n```sh\n# Start a virtual machine with Minikube, then a Kubernetes cluster will be runnig in that VM\nminikube start\n\n# The dashboard allows you to view your applications in a UI \nminikube dashboard\n```\n\n## Basics commands\n\nKubectl is the native CLI for Kubernetes, it performs actions on the Kubernetes cluster once the Minikube virtual machine has been started.\n\n```sh\n# Display addresses of the master and services with label kubernetes.io/cluster-service=true \nkubectl cluster-info\n\n# To further debug and diagnose cluster problems use\nkubectl cluster-info dump\n\n# Show all nodes on that cluster, only \"Status Ready\" nodes will accept applications for deployment\nkubectl get nodes\n\n# Outputs the most important information about all the resources available\nkubectl get all \n```\n\n## Deployment Commands \n\nNow, we are going to practice deployment and managemnt commnands with a [Golang app image](https://hub.docker.com/r/twogghub/k8s-intro/) stored in Docker Hub.\n\n```sh\nkubectl run twogg --image=twogghub/k8s-intro:1.4-k8s\n```\nThe run command creates a new deployment. Here we include the deployment name, and app image location (include the full repository url for images hosted outside Docker hub).\n\nThis command performed a few things for you:\n- Searched for a suitable node where an instance of the application could be run (we have only 1 available node)\n- Scheduled the application to run on that Node\n- Configured the cluster to reschedule the instance on a new Node when needed\n\n```sh\nkubectl get deployments\n```\nIn this case, there is 1 deployment running a single instance of *twogg*. (The instance is running inside a Docker container on that node). Pods that are running inside Kubernetes are running on a private, isolated network. By default they are visible from other pods and services within the same kubernetes cluster, but not outside that network. When we use kubectl, we're interacting through an API endpoint to communicate with our application.\n\n**Cluster Ip Exposure**\n\nThe following are the exposure types that Kubernetes provides for your applications:\n- ClusterIp: Expose service through k8s cluster with ip/name:port\n- NodePort: Expose service through vm's also external to k8s ip/name:port\n- LoadBalancer: Expose service to external connections or whatever you defined in your load balancer setup.\n\n```sh\nkubectl expose deployment twogg --port=8080 --external-ip=$(minikube ip) --type=LoadBalancer\n```\nNow, we are going to deploy a service named **twogg** accesible by the port **8080**, and expose an IP to access it outside the cluster. Also we need to optain and set an external ip from nimukube.\n\n```sh\nkubectl get pods,services --output wide\n```\nTo get detailed information on both pods ans services running use **--output wide** flag. This flags are availiable on most of the get combinations commands.\n\n## Update and Scale Commands \n\n```sh\n# Fist we are going to get more info from our deployed service\nkubectl describe service twogg\n\n# Now we set a new image to be deployed \nkubectl set image deployment twogg twogg=twogghub/k8s-intro:1.5-k8s\n\n# And we are going to scale our pods to 3 replicas in our service \nkubectl scale --replicas=3 deployment twogg\n\n# Check the deployment changes with \nkubectl get deployment twogg --output wide\n```\n\n## Pod interaction commands \n\n```sh\n# To get all pods detailed output\nkubectl get pods --output wide \n\n# To get an open output for all pods  \nkubectl get pods --output wide --watch\n\n# Review a pod's logs\nkubectl logs \u003cpod-name\u003e\n\n# Get pod's info output in a yaml file\nkubectl get pod \u003cpod-name\u003e --output=yaml\n\n# To interac inside the pod\nkubectl exec -ti \u003cpod-name\u003e /bin/bash\n\n```\n\n## Kubectl Proxy\n\n**Note:** Please, try this commands locally Katacoda Kubernetes playground does not support a cloud Kubernetes proxy. \n\nThis kubectl command create a proxy that will forward communications into the cluster-wide, private network. The proxy can be terminated by pressing control-C and won't show any output while its running. \n\n```sh\nkubectl proxy\n```\n\nWith the proxy running now we have a connection between our host and the Kubernetes cluster.\n- Hosted APIs now are available at: http://localhost:8001 \n- To get the version: http://localhost:8001/version\n\nThe API server will automatically create an endpoint for each pod, based on the pod name.\n\n```sh\n# First we need to get the Pod name, and we'll store in the environment variable POD_NAME\nexport POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{\"\\n\"}}{{end}}')\n\n# To output our pods name \necho $POD_NAME\n```\n\nTo make an HTTP request to the application running in that pod: http://localhost:8001/api/v1/proxy/namespaces/default/pods/$POD_NAME/\n\n## Cleaning up your cluster\n\nEvery pod is generated based on its deployment file, every time you delete a pod, it comes up again because you \ndefined the value 'replicas: X' in the deployment file, to delete a Pod/s permanently, You will have to first delete the deployment of that pod and then delete the pod.\n\n```sh\n# To delete an specific pod  \nkubectl delete pod \u003cpod-name\u003e\n\n# This will delete the pod(s) permanently and the deployment itself will be deleted permanently \nkubectl delete deployment \u003cdeploy-name\u003e\n\n# You can alternatively, delete the deployment file from Kubernetes's UI as well\nkubectl delete -f deployment_file_name.yml\n\n# To delete an specific service  \nkubectl delete service \u003cservice-name\u003e\n\n# To delete ALL your workspace\nkubectl delete pods,services,deployments --all\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwogg-git%2Fk8s-intro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwogg-git%2Fk8s-intro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwogg-git%2Fk8s-intro/lists"}