云聚 AI Token Plan 满 199 减 35 元
port:80 AI Junkie
AI 重度玩家的工程笔记本
DigitalOcean 开发者云

Kubernetes 入门(一):核心概念与架构概览

云聚 AI Token Plan 满 199 减 35 元

Build Helloworld.go

package main

import (
    "fmt"
    "log"
    "net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
    log.Println("received request from", r.RemoteAddr, r.URL.Path[1:])
    var welcome = r.URL.Path[1:]
    if len(welcome) == 0 {
        welcome = "World"
    }
    fmt.Fprintf(w, "Hello, %s! ", welcome)
}

func main() {
    http.HandleFunc("/", handler)
    log.Println("starting server on port 9000")
    log.Fatal(http.ListenAndServe(":9000", nil))
}

Make Dockerfile

FROM golang:latest

# 将工作目录设置为 /app
WORKDIR /app

# 将当前目录下的所有内容复制到 /app 下
COPY . /app

# 允许宿主机访问容器的 8000 端口
EXPOSE 9000

# 设置容器进程为:go run helloworld.go
CMD go run helloworld.go

Build Image

docker build -t helloworld:1.0 .

Start container

docker run -d --name myhello -p 9000:9000 helloworld:1.0
阿里云函数计算 一键部署 AI 大模型
赞(0)
未经允许不得转载:80aj » Kubernetes 入门(一):核心概念与架构概览
赞助推荐 FoxCode Claude Code 稳定中转
阿里云函数计算 一键部署 AI 大模型

GLM Claude Code · 国产平替不封号

官方 Claude Code 又涨价又要 KYC,封号还得重配环境?智谱 GLM 兼容 Claude Code,稳定不封号、价格友好,注册后把现有 Claude Code 工作流直接切过来继续用。

立即体验 GLM查看套餐价格