# 部署 nginx ingress controller
$ helm install stable/nginx-ingress --namespace=kube-system --name=nginx-ingress
# 等待 ingress controller 配置完成,并记下外网 IP
$ kubectl --namespace kube-system get services -w nginx-ingress-nginx-ingress-controller
minikube Ingress Controller
minikube 中配置和使用 Ingress Controller 的方法可以参考 这里。
# 注意修改用户名、密码和邮件
$ token=$(echo '{"username":"feisky","password":"secret","email":"feisky@email.com"}' | base64)
# 注意修改 registry.org 和 basedomain
$ draft init --set registry.url=docker.io,registry.org=feisky,registry.authtoken=${token},basedomain=app.feisky.xyz
$ git clone https://github.com/Azure/draft.git
$ cd draft/examples/python
$ ls
app.py requirements.txt
$ cat requirements.txt
flask
$ cat app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return "Hello, World!\n"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
$ draft create
--> Python app detected
--> Ready to sail
$ ls
Dockerfile app.py chart draft.toml requirements.txt
$ cat Dockerfile
FROM python:onbuild
EXPOSE 8080
ENTRYPOINT ["python"]
CMD ["app.py"]
$ cat draft.toml
[environments]
[environments.development]
name = "virulent-sheep"
namespace = "default"
watch = true
watch_delay = 2
$ draft up
--> Building Dockerfile
Step 1 : FROM python:onbuild
onbuild: Pulling from library/python
10a267c67f42: Pulling fs layer
....
Digest: sha256:5178d22192c2b8b4e1140a3bae9021ee0e808d754b4310014745c11f03fcc61b
Status: Downloaded newer image for python:onbuild
# Executing 3 build triggers...
Step 1 : COPY requirements.txt /usr/src/app/
Step 1 : RUN pip install --no-cache-dir -r requirements.txt
....
Successfully built f742caba47ed
--> Pushing docker.io/feisky/virulent-sheep:de7e97d0d889b4cdb81ae4b972097d759c59e06e
....
de7e97d0d889b4cdb81ae4b972097d759c59e06e: digest: sha256:7ee10c1a56ced4f854e7934c9d4a1722d331d7e9bf8130c1a01d6adf7aed6238 size: 2840
--> Deploying to Kubernetes
Release "virulent-sheep" does not exist. Installing it now.
--> Status: DEPLOYED
--> Notes:
http://virulent-sheep.app.feisky.xyzto access your application
Watching local files for changes...
$ curl virulent-sheep.app.feisky.xyz
Hello, World!