[{"data":1,"prerenderedAt":495},["ShallowReactive",2],{"navigation_docs_en":3,"-en-usecases-and-demos-golang":175,"-en-usecases-and-demos-golang-surround":490},[4,35,64,86,108,135,150],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":6},"Quick Start",false,"/en/quick-start","en/1.quick-start",[10,15,20,25,30],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","/en/quick-start/introduction","en/1.quick-start/1.introduction","i-lucide-house",{"title":16,"path":17,"stem":18,"icon":19},"Installation","/en/quick-start/installation","en/1.quick-start/2.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Getting Started","/en/quick-start/getting-started","en/1.quick-start/3.getting-started","i-lucide-rocket",{"title":26,"path":27,"stem":28,"icon":29},"Docker Desktop Extension","/en/quick-start/docker-desktop-extension","en/1.quick-start/4.docker-desktop-extension","i-simple-icons-docker",{"title":31,"path":32,"stem":33,"icon":34},"CLI","/en/quick-start/cli","en/1.quick-start/5.cli","i-lucide-square-terminal",{"title":36,"path":37,"stem":38,"children":39,"page":6},"Local Environments","/en/local-environments","en/2.local-environments",[40,43,48,52,56,60],{"title":21,"path":41,"stem":42,"icon":24},"/en/local-environments/getting-started","en/2.local-environments/1.getting-started",{"title":44,"path":45,"stem":46,"icon":47},"Colima Kubernetes","/en/local-environments/colima","en/2.local-environments/2.colima","i-simple-icons-kubernetes",{"title":49,"path":50,"stem":51,"icon":29},"Docker Desktop Kubernetes (OSX)","/en/local-environments/docker-desktop-osx","en/2.local-environments/3.docker-desktop-osx",{"title":53,"path":54,"stem":55},"k3d","/en/local-environments/k3d","en/2.local-environments/4.k3d",{"title":57,"path":58,"stem":59},"kind","/en/local-environments/kind","en/2.local-environments/5.kind",{"title":61,"path":62,"stem":63},"minikube","/en/local-environments/minikube","en/2.local-environments/5.minikube",{"title":65,"path":66,"stem":67,"children":68,"page":6},"Shared Environments","/en/shared-environments","en/3.shared-environments",[69,72,76,81],{"title":21,"path":70,"stem":71,"icon":24},"/en/shared-environments/getting-started","en/3.shared-environments/1.getting-started",{"title":73,"path":74,"stem":75,"icon":19},"Installing Gefyra in a Cluster","/en/shared-environments/installation","en/3.shared-environments/2.installation",{"title":77,"path":78,"stem":79,"icon":80},"Managing Gefyra Clients","/en/shared-environments/clients","en/3.shared-environments/3.clients","i-lucide-computer",{"title":82,"path":83,"stem":84,"icon":85},"Connecting to Gefyra","/en/shared-environments/connecting","en/3.shared-environments/4.connecting","i-lucide-link",{"title":87,"path":88,"stem":89,"children":90,"page":6},"Remote K8s","/en/remote-k8s","en/4.remote-k8s",[91,94,99,104],{"title":21,"path":92,"stem":93,"icon":24},"/en/remote-k8s/getting-started","en/4.remote-k8s/1.getting-started",{"title":95,"path":96,"stem":97,"icon":98},"Google Cloud Platform (GCP)","/en/remote-k8s/gcp","en/4.remote-k8s/2.gcp","i-material-icon-theme:gcp",{"title":100,"path":101,"stem":102,"icon":103},"Elastic Kubernetes Service (EKS)","/en/remote-k8s/eks","en/4.remote-k8s/3.eks","i-simple-icons-amazoneks",{"title":105,"path":106,"stem":107,"icon":47},"SysEleven MetaKubde Kubernetes","/en/remote-k8s/sys11","en/4.remote-k8s/4.sys11",{"title":109,"path":110,"stem":111,"children":112,"page":6},"Use Cases and Demos","/en/usecases-and-demos","en/5.usecases-and-demos",[113,116,121,126,130],{"title":21,"path":114,"stem":115,"icon":24},"/en/usecases-and-demos/getting-started","en/5.usecases-and-demos/1.getting-started",{"title":117,"path":118,"stem":119,"icon":120},"Developing Go Applications with Gefyra","/en/usecases-and-demos/golang","en/5.usecases-and-demos/2.golang","i-simple-icons-go",{"title":122,"path":123,"stem":124,"icon":125},"OAuth2 Demo with a Sidecar","/en/usecases-and-demos/oauth2-demo","en/5.usecases-and-demos/3.oauth2-demo","i-devicon-plain:oauth",{"title":127,"path":128,"stem":129,"icon":98},"Remote Development on Google Kubernetes Engine","/en/usecases-and-demos/remote-gke","en/5.usecases-and-demos/4.remote-gke",{"title":131,"path":132,"stem":133,"icon":134},"Run an Ubuntu Container instance","/en/usecases-and-demos/ubuntu-in-namespace","en/5.usecases-and-demos/5.ubuntu-in-namespace","i-simple-icons-ubuntu",{"title":136,"path":137,"stem":138,"children":139,"page":6},"Technical Details","/en/technical-details","en/6.technical-details",[140,145],{"title":141,"path":142,"stem":143,"icon":144},"Architecture","/en/technical-details/architecture","en/6.technical-details/1.architecture","i-lucide-square-chevron-right",{"title":146,"path":147,"stem":148,"icon":149},"What is Gefyra?","/en/technical-details/what-is-gefyra","en/6.technical-details/2.what-is-gefyra","i-lucide-circle-question-mark",{"title":151,"path":152,"stem":153,"children":154,"page":6},"Information","/en/information","en/7.information",[155,160,165,170],{"title":156,"path":157,"stem":158,"icon":159},"Run vs. Bridge","/en/information/run-vs-bridge","en/7.information/1.run-vs-bridge","i-lucide-git-compare-arrows",{"title":161,"path":162,"stem":163,"icon":164},"What changed in Gefyra 2?","/en/information/v1-vs-v2","en/7.information/2.v1-vs-v2","i-lucide-history",{"title":166,"path":167,"stem":168,"icon":169},"Media","/en/information/media","en/7.information/3.media","i-lucide-play",{"title":171,"path":172,"stem":173,"icon":174},"About","/en/information/about","en/7.information/4.about","i-lucide-info",{"id":176,"title":117,"body":177,"description":483,"extension":484,"links":485,"meta":486,"navigation":487,"path":118,"seo":488,"stem":119,"__hash__":489},"docs_en/en/5.usecases-and-demos/2.golang.md",{"type":178,"value":179,"toc":476},"minimark",[180,184,189,199,203,240,244,248,283,291,295,317,321,324,353,356,448,458,472],[181,182,183],"tip",{},"Simple Usecase",[185,186,188],"h2",{"id":187},"what-you-will-learn","What you will learn",[190,191,192,196],"ul",{},[193,194,195],"li",{},"Running a Go application in a local container with hot code reloading",[193,197,198],{},"Using Gefyra to bridge the container into a Kubernetes cluster",[185,200,202],{"id":201},"what-you-will-need","What you will need",[190,204,205,211,225,232],{},[193,206,207],{},[208,209,210],"a",{"href":17},"Gefyra",[193,212,213,220,221,224],{},[208,214,219],{"href":215,"rel":216,"target":218},"https://github.com/Getdeck/getdeck",[217],"nofollow","_blank","Getdeck"," for setting up the development infrastructure (runs on ",[222,223,53],"code",{},")",[193,226,227,228],{},"A copy of ",[208,229,230],{"href":230,"rel":231,"target":218},"https://github.com/gefyrahq/gefyra-demos",[217],[193,233,234,235,239],{},"Optionally: ",[208,236,53],{"href":237,"rel":238,"target":218},"https://k3d.io",[217]," or any other preferred Kubernetes cluster",[185,241,243],{"id":242},"creating-the-development-infrastructure","Creating the Development Infrastructure",[245,246,247],"p",{},"After cloning the gefyra-demos repository, you can start a local k3d based Kubernetes cluster with the Go demo workload by running",[249,250,255],"pre",{"className":251,"code":252,"language":253,"meta":254,"style":254},"language-sh shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","cd golang-demo\ndeck get deck.yaml\n","sh","",[222,256,257,270],{"__ignoreMap":254},[258,259,262,266],"span",{"class":260,"line":261},"line",1,[258,263,265],{"class":264},"s2Zo4","cd",[258,267,269],{"class":268},"sfazB"," golang-demo\n",[258,271,273,277,280],{"class":260,"line":272},2,[258,274,276],{"class":275},"sBMFI","deck",[258,278,279],{"class":268}," get",[258,281,282],{"class":268}," deck.yaml\n",[245,284,285,286,290],{},"Once everything is up and running, you can visit ",[208,287,288],{"href":288,"rel":289,"target":218},"http://gefyra-golang.127.0.0.1.nip.io:8080",[217]," to verify that everything worked as expected.",[185,292,294],{"id":293},"the-demo-application","The Demo Application",[245,296,297,298,301,302,305,306,310,311,316],{},"You can look at and tweak the code for the demo application in ",[222,299,300],{},"app/main.go",". You will find a very simple HTTP API that returns a String when it receives GET requests at the base route.\nIn the ",[222,303,304],{},"app","-directory, you'll also find the Dockerfile that is used to build the container image containing our application.\n",[307,308,309],"strong",{},"Note",": In the Dockerfile, we install ",[208,312,315],{"href":313,"rel":314,"target":218},"https://github.com/cosmtrek/air",[217],"air",", a hot reloading utillity for Go development. In a production Dockerfile, you'd want to specify a dedicated\nbuild target to install air.",[185,318,320],{"id":319},"enter-gefyra","Enter Gefyra",[245,322,323],{},"In order to connect a locally running container to a Kubernetes cluster, we use Gefyra.\nFirst of all, we need to build an image on our development machine like so:",[249,325,327],{"className":251,"code":326,"language":253,"meta":254,"style":254},"cd app\ndocker build . -t gefyra-golang-example\n",[222,328,329,336],{"__ignoreMap":254},[258,330,331,333],{"class":260,"line":261},[258,332,265],{"class":264},[258,334,335],{"class":268}," app\n",[258,337,338,341,344,347,350],{"class":260,"line":272},[258,339,340],{"class":275},"docker",[258,342,343],{"class":268}," build",[258,345,346],{"class":268}," .",[258,348,349],{"class":268}," -t",[258,351,352],{"class":268}," gefyra-golang-example\n",[245,354,355],{},"Once the build is finished, we are ready to get started with Gefyra:",[249,357,359],{"className":251,"code":358,"language":253,"meta":254,"style":254},"gefyra up\ngefyra run -i gefyra-golang-example -N gefyra-golang-example -n golang-demo -c air -v $(pwd):/app\ngefyra bridge -N gefyra-golang-example --container-name gefyra-golang-demo --deployment gefyra-golang-demo --port 3333:3333 -n golang-example\n",[222,360,361,369,414],{"__ignoreMap":254},[258,362,363,366],{"class":260,"line":261},[258,364,365],{"class":275},"gefyra",[258,367,368],{"class":268}," up\n",[258,370,371,373,376,379,382,385,387,390,393,396,399,402,406,409,411],{"class":260,"line":272},[258,372,365],{"class":275},[258,374,375],{"class":268}," run",[258,377,378],{"class":268}," -i",[258,380,381],{"class":268}," gefyra-golang-example",[258,383,384],{"class":268}," -N",[258,386,381],{"class":268},[258,388,389],{"class":268}," -n",[258,391,392],{"class":268}," golang-demo",[258,394,395],{"class":268}," -c",[258,397,398],{"class":268}," air",[258,400,401],{"class":268}," -v",[258,403,405],{"class":404},"sMK4o"," $(",[258,407,408],{"class":264},"pwd",[258,410,224],{"class":404},[258,412,413],{"class":268},":/app\n",[258,415,417,419,422,424,426,429,432,435,437,440,443,445],{"class":260,"line":416},3,[258,418,365],{"class":275},[258,420,421],{"class":268}," bridge",[258,423,384],{"class":268},[258,425,381],{"class":268},[258,427,428],{"class":268}," --container-name",[258,430,431],{"class":268}," gefyra-golang-demo",[258,433,434],{"class":268}," --deployment",[258,436,431],{"class":268},[258,438,439],{"class":268}," --port",[258,441,442],{"class":268}," 3333:3333",[258,444,389],{"class":268},[258,446,447],{"class":268}," golang-example\n",[245,449,450,453,454,457],{},[222,451,452],{},"gefyra up"," will start the cluster and client side components needed for Gefyra to do it's thing.\nThe ",[222,455,456],{},"gefyra run"," command will then start a container from the image that we just build in the development infrastructure that we created before.\nFinally, 'gefyra bridge' will overlay our local container over the one that we specified in the run command.",[245,459,460,461,464,465,468,469,471],{},"Once Gefyra tells you that the bridge is established, you're ready to make some changes and check out hot code reloading in Kubernetes in action.\nVisit ",[208,462,288],{"href":288,"rel":463,"target":218},[217]," in your browser and try changing the contents of the\n",[222,466,467],{},"io.WriteString"," function. Since we mounted our code into the container during ",[222,470,456],{},", air will detect the changes and rebuild/restart our application.\nRefresh your browser and check out the results!",[473,474,475],"style",{},"html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}",{"title":254,"searchDepth":272,"depth":272,"links":477},[478,479,480,481,482],{"id":187,"depth":272,"text":188},{"id":201,"depth":272,"text":202},{"id":242,"depth":272,"text":243},{"id":293,"depth":272,"text":294},{"id":319,"depth":272,"text":320},"This example demonstrates how to run a local Golang container with hot code reloading as part of your Kubernetes namespace.","md",null,{},{"icon":120},{"title":117,"description":483},"fzmXVLnmBcTkuMT0uiwlm8hGT1ZpvK0cY7d0w-Alvr0",[491,493],{"title":21,"path":114,"stem":115,"description":492,"icon":24,"children":-1},"This chapter contains example use cases and demos. Feel free to adapt these architectures to your applications.",{"title":122,"path":123,"stem":124,"description":494,"icon":125,"children":-1},"This example demonstrates how to develop a Kubernetes sidecar pattern for an OAuth2 (OpenID Connect) authorized backend service using Gefyra.",1775752112239]