Files
k3s-configs/k3s/kaifa/pj1test/main.py
2026-01-21 08:37:05 +00:00

15 lines
344 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from flask import Flask
import socket
app = Flask(__name__)
@app.route('/')
def hello():
# 获取当前容器的主机名
pod_name = socket.gethostname()
return f"<h1>Hello Fei! (v2)</h1><p>Running in Pod: <b>{pod_name}</b></p>"
if __name__ == '__main__':
# 监听所有IP端口5000
app.run(host='0.0.0.0', port=5000)