k8s 文件最简编写手册
创建命名空间
kind: Namespace
apiVersion: v1
metadata:
name: biz
创建Deployments
kind: Deployment
apiVersion: apps/v1
metadata:
namespace: biz
name: test-app
labels:
app: test-app
spec:
selector:
matchLabels:
app: test-app
template:
metadata:
labels:
app: test-app
spec:
containers:
- name: test-app
image: alpine:3.11
resources:
limits:
cpu: 200m # 100m means one hundred millicpu = 0.1 cpu
memory: 256Mi # or 256M
requests:
cpu: 100m
memory: 128Mi
command: ["/bin/sh"]
args: ["-c", "while true; do echo hello; sleep 10; done"]
创建 Service
apiVersion: v1
kind: Service
metadata:
namespace: biz
name: test-app
spec:
ports:
- port: 8080
protocol: TCP
selector:
app: test-app
创建Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: biz
name: ingress-nginx
spec:
rules:
- host: k3s.iamqt.com
http:
paths:
- backend:
serviceName: test-app
servicePort: 8080
最后更新于 2022-01-15 22:55:05 并被添加「」标签,已有 3497 位童鞋阅读过。
本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处
大佬 大佬