在Vagrant / VirtualBox中安装了CentOS 7主机。然后推出Rancher服务器/ k8s集群。
使用kompose
将docker-compose
文件转换为kubernetes配置文件。
如:
静电deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.4.0 (c7964e7)
creationTimestamp: null
labels:
io.kompose.service: static
name: static
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: static
spec:
containers:
- args:
- ./entrypoint.sh
image: 192.168.33.13/myapp/static
name: orange-static
ports:
- containerPort: 10301
resources: {}
volumeMounts:
- mountPath: /var/www
name: static-claim0
- mountPath: /var/www/dist/assets
name: static-claim1
- mountPath: /var/www/dist/api-mock
name: static-claim2
restartPolicy: Always
volumes:
- name: static-claim0
persistentVolumeClaim:
claimName: static-claim0
- name: static-claim1
persistentVolumeClaim:
claimName: static-claim1
- name: static-claim2
persistentVolumeClaim:
claimName: static-claim2
status: {}
静电service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.4.0 (c7964e7)
creationTimestamp: null
labels:
io.kompose.service: static
name: static
spec:
ports:
- name: "10301"
port: 10301
targetPort: 10301
selector:
io.kompose.service: static
status:
loadBalancer: {}
静电claim0-persistentvolumeclaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: static-claim0
name: static-claim0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
静电claim1-persistentvolumeclaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: static-claim1
name: static-claim1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
静电claim2-persistentvolumeclaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: static-claim2
name: static-claim2
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
status: {}
运行kubectl create -f static-deployment.yaml
并检查k8s信息中心后:
该怎么办?这是Vagrant现在没有存在量的原因吗?