{"id":19014530,"url":"https://github.com/deeptiman/go-cache-kubernetes","last_synced_at":"2025-10-10T16:41:43.646Z","repository":{"id":144413238,"uuid":"289633904","full_name":"Deeptiman/go-cache-kubernetes","owner":"Deeptiman","description":"The web application is a Data Caching Service designed and implemented using microservices architecture. ","archived":false,"fork":false,"pushed_at":"2021-06-14T21:48:57.000Z","size":245,"stargazers_count":14,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-07T19:53:46.221Z","etag":null,"topics":["docker","docker-compose","golang","golang-library","gomongo","kafka","kafka-consumer","kafka-producer","kubernetes","kubernetes-cluster","kubernetes-deployment","microservices-architecture","mongodb","redis","redis-cache","redis-client"],"latest_commit_sha":null,"homepage":"https://github.com/Deeptiman/go-cache-kubernetes","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Deeptiman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-23T07:01:35.000Z","updated_at":"2024-12-22T11:38:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"c37a5c9f-9b63-470b-b829-1c786d381fdd","html_url":"https://github.com/Deeptiman/go-cache-kubernetes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Deeptiman/go-cache-kubernetes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeptiman%2Fgo-cache-kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeptiman%2Fgo-cache-kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeptiman%2Fgo-cache-kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeptiman%2Fgo-cache-kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deeptiman","download_url":"https://codeload.github.com/Deeptiman/go-cache-kubernetes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeptiman%2Fgo-cache-kubernetes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004702,"owners_count":26083751,"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-10-10T02:00:06.843Z","response_time":62,"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":["docker","docker-compose","golang","golang-library","gomongo","kafka","kafka-consumer","kafka-producer","kubernetes","kubernetes-cluster","kubernetes-deployment","microservices-architecture","mongodb","redis","redis-cache","redis-client"],"created_at":"2024-11-08T19:29:51.469Z","updated_at":"2025-10-10T16:41:43.617Z","avatar_url":"https://github.com/Deeptiman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-cache-kubernetes\n\u003cp\u003e     \n\t\u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/Deeptiman/go-cache-kubernetes\"\u003e\n\t\u003cimg alt=\"GitHub language count\" src=\"https://img.shields.io/github/languages/count/Deeptiman/go-cache-kubernetes\"\u003e \n\t\u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/Deeptiman/go-cache-kubernetes\"\u003e \n\u003c/p\u003e\nThe web application is a Data Caching service designed and implemented using microservices architecture. The cloud deployment environments are used Kubernetes, Docker, and written in Go programming language. The application also uses a MongoDB as NoSQL database with Redis in-memory database for the caching services.\n\n## Features\n\n - **MongoDB** is implemented to perform several database operations. The installation can be done using the go dependency module.\n\t\t\n\t\tgo get go.mongodb.org/mongo-driver/mongo\n\t  https://github.com/mongodb/mongo-go-driver\n\n - **Redis Cache** is implemented to integrate the data caching in the application. So, the \u003cb\u003ego-redis\u003c/b\u003e will cache the second GET request while reading the user details.\n \n\t\tgo get github.com/go-redis/redis/v8\n\t  https://github.com/go-redis/redis\n\n - **Kafka Message Broker**: The \u003cb\u003econfluent-kafka-go\u003c/b\u003e is used as a Go client library for Kafka message broker. The library will provide **Producer** and **Consumer** architecture to stream messages to the user for a subscribed topic. So, there will be two REST APIs that the user can use for Producing the messages reading from MongoDB and Consuming or Reading messages from the message broker.\n\n\t\tgo get github.com/confluentinc/confluent-kafka-go/kafka\n\thttps://github.com/confluentinc/confluent-kafka-go\n\n\tNote: It's recommended to install **confluent-kafka-go v1.4.0**, as the **librdkafka** will come with the bundle and no need to install separately.\n\n## Kubernetes tools\nKubernetes provides several tools that can be useful to setup Kubernetes in the local environment.\n\n - **minikube** tool will run a single-node Kubernetes cluster running inside a Virtual Machine. Virtualization has to be supported in the computer and Hypervisor needed to be enabled.\n\t    \n\t **Installation**\n\t    follows with the Hypervisor installation and [Hyperkit](https://minikube.sigs.k8s.io/docs/drivers/hyperkit/) is the recommended virtualization toolkit.   \n\n\t\t$ sudo install minikube\n\t\t\n\t\t$ minikube start\n\thttps://kubernetes.io/docs/setup/learning-environment/minikube/\n\t \n\t\n\t\t\n\n - **kubectl** command-line tool will work to manage a Kubernetes cluster. The tool will be used to deploy, create, analyze, inspect pods that are running under a Kubernetes cluster.\n\n\n\t**Installation**\n\t\n\t```curl -LO \"https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl\" ```\n\n\thttps://kubernetes.io/docs/tasks/tools/install-kubectl/\n\n\n## Build the Docker images\n\nThe application uses Docker for container-based development. The docker image gets published as a public repository at Docker Hub.\n\n - **Build the image**\n\n\t\t$ docker build -t go-cache-kubernetes-v1 .\n\n - **Tag the image**\n\n\t\t$ docker tag go-cache-kubernetes-v1 deeptiman1991/go-cache-kubernetes-v1:1.0.0\n\n - **Login to docker hub**\n\n\t\t$ docker login\n\n\t\tType Username and Password to complete the authentication\n\n - **Push the image to docker hub**\n\n\t\t$ docker push deeptiman1991/go-cache-kubernetes-v1:1.0.0\n\n## Kubernetes Deployment\nThere will be several deployments, services that need to be running in the cluster as a Pod. The creation of a Pod requires a YAML file that will specify the kind, spec, containerPort, metadata, volume, and more. So, these parameters will be used to provide resources to the Kubernetes cluster.\n\n**Start minikube** to begin the deployment process start the minikube \n\t\n\t$ minikube start\n\n\u003ch3\u003eKubernetes Secret Management\u003c/h3\u003e \nThe application will be using few MongoDB credentials for database connection. So the username and password will be secure using HashiCorp Vault as static secrets.\n\u003cbr\u003e\u003cbr\u003e\n \u003cp\u003eMore details explanation on HashiCorp Vault, please check my Medium article : \u003ca href=\"https://medium.com/@deeptiman/secrets-in-kubernetes-and-hashicorp-vault-d04d83d0400b\"\u003eSecrets in Kubernetes and HashiCorp Vault\u003c/a\u003e \u003c/p\u003e\n \u003cbr\u003e\n \u003cp\u003e \u003cb\u003e Implement the Vault Envs in the pod deployment \u003c/b\u003e \u003c/p\u003e\n\t\t\n\t    spec:\n\t      serviceAccountName: vault\n\t      containers:\n\t      - name: go-cache-kubernetes-container-poc\n\t\timage: deeptiman1991/go-cache-kubernetes-v1:1.0.0\n\t\tenv:\n\t\t- name: VAULT_ADDR\n\t\t  value: \"http://vault:8200\"\n\t\t- name: JWT_PATH\n\t\t  value: \"/var/run/secrets/kubernetes.io/serviceaccount/token\"\n\t\t- name: SERVICE_PORT\n\t\t  value: \"8080\"\t\t\n  \u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/go_cache_app/go-cache-poc-app.yaml#L19\" target=\"_blank\"\u003ego-cache-poc-app.yaml\u003c/a\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\t\u003c/table\u003e\n\u003c/p\u003e\t\n\u003cp\u003eSo, now SECRET_USERNAME \u0026 SECRET_PASSWORD environment variables can be used to connect to the MongoDB database from the application. \u003c/p\u003e\n    \n\u003ch3\u003eDeploy PersistentVolumeClaim\u003c/h3\u003e \n\nThis will allocate a volume of 1GB storage in the cluster\n\u003cbr\u003e\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003ego-cache-poc-pvc\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003ePersistentVolumeClaim\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/go_cache_app/go-cache-poc-pvc.yaml\" target=\"_blank\"\u003ego-cache-poc-pvc.yaml\u003c/a\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\t\u003c/table\u003e\n\n    $ kubectl apply -f go-cache-poc-pvc.yaml\n\n\u003ch3\u003eDeploy Go Web App\u003c/h3\u003e \n\nThis will load the web app Docker image in the cluster.\t\n\u003cbr\u003e\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003ego-cache-poc\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eDeployment\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/go_cache_app/go-cache-poc-app.yaml\" target=\"_blank\"\u003ego-cache-poc-app.yaml\u003c/a\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\t\u003c/table\u003e\n\n    $ kubectl apply -f go-cache-poc-app.yaml\t\n\n**Verify**\n\n\t$ kubectl get deployments\n\tNAME           \t\t      READY   UP-TO-DATE   AVAILABLE   AGE\n\tgo-cache-kubernetes-app-poc   1/1     1            1           14s\t\n\t  \n\tThere is only one pod is running under this deployment.\n\n\u003ch3\u003eDeploy Go Web App Service\u003c/h3\u003e\n\nThis service will create an external endpoint using a LoadBalancer.\n\u003cbr\u003e\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003ego-cache-poc-service\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eService\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/go_cache_app/go-cache-poc-svc.yaml\" target=\"_blank\"\u003ego-cache-poc-svc.yaml\u003c/a\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\t\u003c/table\u003e\n\n\n\t$ kubectl apply -f go-cache-poc-svc.yaml\n\t\n**Verify**\n\n\t$ kubectl get services\n\n \u003ch3\u003eDeploying MongoDB ReplicaSet as a Kubernetes StatefulSet\u003c/h3\u003e\n\n\n\u003cp\u003eKubernetes provides a feature that will allow us to create a stateful application in the cluster. There will be a storage class and services running under the cluster that will allow the databases to connect with services and store records in their persistent database.\u003c/p\u003e\n\u003cbr\u003e\n\u003cp\u003eMore details explanation on MongoDB StatefulSet, please check my Medium article : \u003ca href=\"https://medium.com/@deeptiman/mongodb-statefulset-in-kubernetes-87c2f5974821\"\u003eMongoDB StatefulSet in Kubernetes\u003c/a\u003e \u003c/p\u003e\n\u003cbr\u003e\n \u003cb\u003eMongoDB service\u003c/b\u003e will create the Mongo services in the cluster.\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003emongodb-service\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eService\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/mongodb/mongodb-service.yaml\" target=\"_blank\"\u003emongodb-service.yaml\u003c/a\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\t\u003c/table\u003e\n\n\t   $ kubectl apply -f mongodb-service.yaml\n\t \n**MongoDB StatefulSet** will create the StatefulSet app in the cluster.\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003emongod\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003eStatefulSet\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/mongodb/mongodb-statefulset.yaml\" target=\"_blank\"\u003emongodb-statefulset.yaml\u003c/a\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\t\u003c/table\u003e\n\n\t   $ kubectl apply -f mongodb-statefulset.yaml\n\n#### Define the Administrator\nThere will be three mongo containers in the cluster. We need to connect to anyone of them to define the administrator.\nCommand to exec\n\n\t $ kubectl exec -it mongod-0 -c mongod-container bash\n\t-it: mongo app name\n\t-c:  mongo container name\nBash\n\n  \t$ hostname -f\n\t     \n\t mongod-0.mongodb-service.default.svc.cluster.local\n\nMongo Shell\n\n\t $ mongo\n\nType to the following query to generate the replica set\n\n\t\u003e rs.initiate({_id: \"MainRepSet\", version: 1, members: [\n\t\t{ _id: 0, host : \"mongod-0.mongodb-service.default.svc.cluster.local:27017\" }\n\t]}); \t  \t\n\t \t \nthen verify\t\n\t\t\t    \t\n\t\u003e rs.status();\n\nNow create the Admin user\n\n\t\t\u003e db.getSiblingDB(\"admin\").createUser({\n\t\t      user : \"admin\",\n\t\t      pwd  : \"admin123\",\n\t\t      roles: [ { role: \"root\", db: \"admin\" } ]\n\t\t });\n\t\t \nSo, now the MongoDB is complete setup with ReplicaSet and with an Administrator for the database.\n\n\u003ch3\u003eDeploy Redis in Kubernetes\u003c/h3\u003e\nThere will be several steps to follow for deploying Redis into the Kubernete cluster. \n\u003cbr\u003e\u003cbr\u003e\n\t\u003cp\u003e\u003cb\u003eDownload Docker images for Redis\u003c/b\u003e\u003c/p\u003e\n\t\u003cp\u003e \n   \t   \u003ccode\u003e$ docker run -p 6379:6379 redislabs/redismod\u003c/code\u003e\t\n\t\u003c/p\u003e\t\n\t \u003cp\u003e\u003cb\u003eRedis Deployment\u003c/b\u003e\u003c/p\u003e\n\t\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\t  \u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eredismod\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eDeployment\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/redis/redis-deployment.yaml\" target=\"_blank\"\u003eredis-deployment.yaml\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t  \u003c/tbody\u003e\n\t\t\u003c/table\u003e\n\t \t\u003cp\u003e\u003ccode\u003e$ kubectl apply -f redis-deployment.yaml\u003c/code\u003e\u003c/p\u003e\n\t\n   \u003cp\u003e\u003cb\u003eRedis Service\u003c/b\u003e\u003c/p\u003e\n   \t\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\t  \u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eredis-service\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eService\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/redis/redis-service.yaml\" target=\"_blank\"\u003eredis-service.yaml\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t  \u003c/tbody\u003e\n\t\t\u003c/table\u003e\n\t\u003cp\u003e\u003ccode\u003e$ kubectl apply -f redis-service.yaml\u003c/code\u003e\u003c/p\u003e\t\n\t\u003cp\u003e\u003cb\u003eDeploy the redismod image\u003c/b\u003e\u003c/p\u003e\n\t\u003cp\u003e\n\t  \u003ccode\u003e$ kubectl run redismod --image=redislabs/redismod --port=6379\u003c/code\u003e\n\t\u003c/p\u003e\n\t\u003cp\u003e\u003cb\u003eExpose the deployment\u003c/b\u003e\u003c/p\u003e\n\t\u003cp\u003e\n\t  \u003ccode\u003e$ kubectl expose deployment redismod --type=NodePort\u003c/code\u003e\n\t\u003c/p\u003e\n\t\u003cp\u003e\u003cb\u003eNow, check for the Redis Connection\u003c/b\u003e\u003c/p\u003e\n\t\u003cp\u003e\n\t  \u003ccode\u003e$ redis-cli -u $(minikube service --format \"redis://{{.IP}}:{{.Port}}\" --url redismod)\u003c/code\u003e\n\t\u003c/p\u003e\n\t \u003ccode\u003eYou must be getting an ip address with a port that can be used as a connection string for Redis\u003c/code\u003e\n\n\u003ch3\u003eDeploy Kafka in Kubernetes\u003c/h3\u003e\nThere will be a deployment of ZooKeeper, Kafka Service, and running kafka/zookeeper server script. Please install \u003ca href=\"https://kafka.apache.org/downloads\"\u003eApache Kafka\u003c/a\u003e in your local machine and gcloud.\n\u003cbr\u003e\n\u003ch4\u003eZookeeper\u003c/h4\u003e\nThere will be deployment and service similar to the other Pods running in the cluster.\n\t \u003ch5\u003ezookeeper-deployment\u003c/h5\u003e\n\t \u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\t  \u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003ezookeeper-app\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eDeployment\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/kafka/zookeeper-deployment.yaml\" target=\"_blank\"\u003ezookeeper-deployment.yaml\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t  \u003c/tbody\u003e\n\t\t\u003c/table\u003e\n\t \t\n\t$ kubectl apply -f zookeeper-deployment.yaml\n\t\t    \n \u003ch5\u003ezookeeper-service\u003c/h5\u003e\n \u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\t  \u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003ezookeeper-service\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eService\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/kafka/zookeeper-service.yaml\" target=\"_blank\"\u003ezookeeper-service.yaml\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t  \u003c/tbody\u003e\n\t\t\u003c/table\u003e\n\t \t\n    $ kubectl apply -f zookeeper-service.yaml\n\t\t    \n\u003ch4\u003eKafka\u003c/h4\u003e\n\u003ch5\u003ekafka-service\u003c/h5\u003e\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\t  \u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003ekafka-service\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eService\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/kafka/kafka-service.yaml\" target=\"_blank\"\u003ekafka-service.yaml\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t  \u003c/tbody\u003e\n\t\t\u003c/table\u003e\n\t\t   \n\t         \n\t \t\n \t$ kubectl apply -f kafka-service.yaml\n\n\u003ch5\u003ekafka-replication-controller\u003c/h5\u003e\n\t\u003ctable class=\"table table-striped table-bordered\"\u003e\n\t\t  \u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eName\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003ekafka-repcon\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eKind\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003eDeployment\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\u003ctd\u003e\u003cb\u003eYAML\u003c/b\u003e\u003c/td\u003e\n\t\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/deploy_kubernetes/kafka/kafka-repcon.yaml\" target=\"_blank\"\u003ekafka-repcon.yaml\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t  \u003c/tbody\u003e\n\t\t\u003c/table\u003e\n\n\t \t\n\t$ kubectl apply -f kafka-repcon.yaml\n\t\t\n\n\u003ch3\u003eStart zookeeper/kafka server\u003c/h3\u003e\n   \u003ch4\u003ezookeeper server\u003c/h4\u003e\n\t\t  \n\t$ cd kafka/\n\t$~/kafka/ bin/zookeeper-server-start.sh config/zookeeper.properties\t\n\n   \u003ch4\u003ekafka server\u003c/h4\u003e\n\t\t \n\t$ cd kafka/\n\t$~/kafka/ bin/kafka-server-start.sh config/server.properties\n\t\t\t\t\n\n## Troubleshoot with kubectl\n\nThe kubectl is a very handy tool while troubleshooting application into the Kubernetes.\n\n**Few useful commands**\n\u003col\u003e\n\t\u003cli\u003e kubectl get pods \u003c/li\u003e\n\t\u003cli\u003e kubectl describe pods \u003cpod-name\u003e  \u003c/li\u003e\n\t\u003cli\u003e kubectl logs \u003cpod-name\u003e  \u003c/li\u003e\n\t\u003cli\u003e kubectl exec -ti \u003cpod-name\u003e --bash \u003c/li\u003e\n\u003c/ol\u003e\n\n## Swagger API documentation\n\nThe \u003cb\u003ego-swagger\u003c/b\u003e toolkit is integrated for the REST APIs documentation. The API doc can be accessible via http://localhost:5000/docs\n\n\u003cp\u003e\u003ca href=\"https://github.com/go-swagger/go-swagger\" target=\"_blank\"\u003ehttps://github.com/go-swagger/go-swagger\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/swagger.yaml\" target=\"_blank\"\u003eswagger.yaml\u003c/a\u003e\u003c/p\u003e\n\n## More Info\n\u003cul\u003e\n\t\u003cli\u003e \u003ca href=\"https://kubernetes.io/docs/setup/\"\u003eGetting started Kubernetes\u003c/a\u003e \u003c/li\u003e\n\t\u003cli\u003e \u003ca href=\"https://kubernetes.io/docs/concepts/configuration/secret/\"\u003eKubernetes Secret Managements\u003c/a\u003e \u003c/li\u003e\n\t\u003cli\u003e \u003ca href=\"https://kubernetes.io/docs/tutorials/hello-minikube/\"\u003eHello Minikube\u003c/a\u003e\u003c/li\u003e\n\t\u003cli\u003e \u003ca href=\"https://docs.docker.com/get-started/\"\u003eDocker Documentation\u003c/a\u003e\u003c/li\u003e\n\t\u003cli\u003e \u003ca href=\"https://redocly.github.io/redoc/\"\u003eSwagger ReDoc\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\u003cp\u003eThis project is licensed under the \u003ca href=\"https://github.com/Deeptiman/go-cache-kubernetes/blob/master/LICENSE\"\u003eMIT License\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeptiman%2Fgo-cache-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeptiman%2Fgo-cache-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeptiman%2Fgo-cache-kubernetes/lists"}