来自: 课外阅读:- 2021-03-30 09:54:43
$ git clone [//github.com/okteto/go-getting-started](//github.com/okteto/go-getting-started)该k8s.yml资料涉及用以谋划Go Sample App的Kubernetes申报单。能够 完成这系统命令作业软件软件:
$ cd go-getting-started
$ kubectl apply -f k8s.yml这很酷!您键入了是一个强制性,您的应运程序流程图的发掘型号仅运转。
deployment.apps “hello-world” created
service “hello-world” created
$ curl [//get.okteto.com](//get.okteto.com/) -sSfL | shWindows
$ wget [//downloads.okteto.com/cli/okteto-Windows-x86_64](//downloads.okteto.com/cli/okteto-Windows-x86_64) -OutFile c:\windows\system32\okteto.exe
$ okteto up该okteto up运行命令将无法Kubernetes设计规划生态,这暗示着:
✓ Development environment activated
✓ Files synchronized
Namespace: pchico83
Name: hello-world
Forward: 8080 -> 8080
2345 -> 2345
okteto>
okteto> go run main.go第一名次工作该APP领域系统流程图时,Go会使用您的依懒项并编译您的APP领域系统流程图。稍候此的过程 到位并进行在原生shell系统流程图中工作低于指令来考试您的APP领域系统流程图:
Starting hello-world server...
$ curl localhost:8080
Hello world!
func helloServer(w http.ResponseWriter, r *http.Request) {Okteto将您的变化同时到Kubernetes中的研发区域环境。go run main.go采用按注销从远控Shell 执行过程ctrl + c。从新运转您的适用过程:
fmt.Fprint(w, “Hello world from the cluster!”)
}
okteto> go run main.go从本地化金属外壳跳转您的技术APP流程以认可改换:
Starting hello-world server...
$ curl localhost:8080您的源代码就要变更可以运用于Kubernetes。不能不去提交,构造 或消息提醒!
Hello world from the cluster!
okteto> dlv debug --headless --listen=:2345 --log --api-version=2打开文档Debug突出并使用Connect to okteto启动服务器分配:
API server listening at: [::]:2345
2019–10–17T14:39:24Z info layer=debugger launching process with args: [/okteto/__debug_bin]
{在main.go第57行上“添加某个断点。借助从本市Shell强制执行来加载您的app程序流程:
“version”: “0.2.0”,
“configurations”: [
{
“name”: “Connect to okteto”,
“type”: “go”,
“request”: “attach”,
“mode”: “remote”,
“remotePath”: “/okteto”,
“port”: 2345,
“host”: “127.0.0.1”
}
]
}
$ curl localhost:8080实行将在您的断点处关闭程序。接下来,您可查检post请求,该用数组等。
免责声明及提醒:此文内容为本网所转载企业宣传资讯,该相关信息仅为宣传及传递更多信息之目的,不代表本网站观点,文章真实性请浏览者慎重核实!任何投资加盟均有风险,提醒广大民众投资需谨慎!