微服务架构在Kubernetes上的实现
系统运维 2025-10-07 18:07:28
0

复制package main import ( "fmt" "log" "net/http" "os" ) func handler(w http.ResponseWriter,微服务架 r *http.Request) { log.Print("Hello world received a request.") version := os.Getenv("VERSION") if version == "" { version = "v1" } log.Println(version) fmt.Fprintf(w, "Hello world %s\n",version) } func main() { log.Print("Hello world sample started.") http.HandleFunc("/api/hello", handler) port := os.Getenv("PORT") if port == "" { port = "8080" } log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil)) } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.