http://www.reibang.com/writer#/notebooks/38731188/notes/51148676/preview
在dockfile基礎上先把做好的鏡像推到本地倉庫
docker tag nginx:v1 10.0.0.11:5000/nginx:v1
docker push 10.0.0.11:5000/nginx:v1
創(chuàng)建rc
vim /k8s/rc/rc_kod.yaml
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 5
selector:
app: myweb
template:
metadata:
labels:
app: myweb
spec:
containers:
- name: myweb
image: 10.0.0.11:5000/nginx:v1
ports:
- containerPort: 80
kubectl create -f /k8s/rc/rc_kod.yaml
創(chuàng)建service(用于負載)
vim /k8s/svc/svc_kod.yaml
apiVersion: v1
kind: Service
metadata:
name: myweb
spec:
type: NodePort
ports:
- port: 80
nodePort: 3000
targetPort: 80
selector:
app: myweb
kubectl create -f /k8s/rc/svc_kod.yaml