部署 whoami 应用
# whoami.yaml
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: whoami-deployment
spec:
replicas: 4
template:
metadata:
labels:
app: whoami
group: app1
spec:
containers:
- image: containous/whoami
name: whoami
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: whoami
spec:
selector:
app: whoami
group: app1
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx-ingress
spec:
rules:
- host: whoami.domain.com
- host: whoami
http:
paths:
- backend:
serviceName: whoami
servicePort: 80
kubectl get svc --all-namespaces
curl -D- -H 'host:whoami' http://<ingress-nginx-EXTERNAL-IP>
网友评论