本文介绍MAC上安装配置Minishift,如需其他操作系统介绍,请留言
安装Minishift
需要先安装brew.
#使用brew安装minishift
brew cask install minishift
#安装hyperkit
brew install hyperkit
#安装VM driver
brew install docker-machine-driver-hyperkit
配置Minishift config
设置vm driver和insecurity registry
#设置vm driver
minishift config set vm-driver hyperkit
#设置docker insecurity registry
minishift config set insecure-registry REGISTRY_IP:5000
#启动Minishift
minishift start
Openshift命令
oc new-project projectName (create new namespace projectName)
oc project projectName (switch to namespace projectName)
#如果container需要用root用户,执行下面2条命令
oc login -u system:admin (login as systemadmin)
oc adm policy add-scc-to-user anyuid -z default (user root folder to start container)
如何共享本机目录到pod
首先要设置scc,然后使用hostfolder命令创建shared foldler
oc edit scc restricted (update the following setting)
allowHostDirVolumePlugin: true
minishift hostfolder add -t sshfs --source /Users/neng/local --target /mnt/hostlocal hostlocal
minishift hostfolder mount hostlocal
在pod或deployment yaml文件, 使用这个共享文件夹
volumeMounts:
- name: mount-volume
mountPath: /usr/test
volumes:
- name: mount-volume
hostPath:
path: /mnt/hostlocal
网友评论