新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
15
learn/learn-kubernetes-master/kiamol/ch03/lab/README.md
Normal file
15
learn/learn-kubernetes-master/kiamol/ch03/lab/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
kubectl apply -f deployments.yaml
|
||||
|
||||
kubectl get pods
|
||||
|
||||
> There are two versions of the web app
|
||||
|
||||
[services.yaml](./solution/services.yaml) defines a ClusterIP service for the API and a LoadBalancer service for the web app. The selector for the web service uses two labels to ensure only the v2 pod is included.
|
||||
|
||||
```
|
||||
kubectl apply -f solution/services.yaml
|
||||
```
|
||||
|
||||
> http://localhost:8088
|
||||
|
||||

|
||||
@@ -0,0 +1,56 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lab-numbers-api
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lab-numbers-api
|
||||
version: v1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lab-numbers-api
|
||||
version: v1
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: kiamol/ch03-numbers-api
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lab-numbers-web
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lab-numbers-web
|
||||
version: v1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lab-numbers-web
|
||||
version: v1
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: kiamol/ch03-numbers-web
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lab-numbers-web-v2
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lab-numbers-web
|
||||
version: v2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lab-numbers-web
|
||||
version: v2
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: kiamol/ch03-numbers-web:v2
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
@@ -0,0 +1,24 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: numbers-api
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: lab-numbers-api
|
||||
version: v1
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: numbers-web
|
||||
spec:
|
||||
ports:
|
||||
- port: 8088
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: lab-numbers-web
|
||||
version: v2
|
||||
type: LoadBalancer
|
||||
Reference in New Issue
Block a user