OpenShift helm的安装
生活随笔
收集整理的這篇文章主要介紹了
OpenShift helm的安装
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1.安裝過程
下載addons的代碼
$ git clone https://github.com/jorgemoralespou/minishift-addons $ cd minishift-addons因為helm的tiller要求訪問gcr的地址,必然被墻,因此把地址替換成ericnie2017/tiller:latest 后建立
ericdeMacBook-Pro:helm ericnie$ cat helm.addon # Name: helm # Description: Installs helm#?Pull the image echo "pull start" docker pull lachlanevenson/k8s-helm:v2.8.1echo "deploy start" #?Deploy helm docker run --rm -v /home/docker:/root:z -v /var/lib/minishift/openshift.local.config:/var/lib/minishift/openshift.local.config:z --net=host --env KUBECONFIG=/var/lib/minishift/openshift.local.config/master/admin.kubeconfig --env HELM_HOST=localhost:8443 lachlanevenson/k8s-helm:v2.8.1 init --upgrade -i ericnie2017/tiller:latest --skip-refreshecho "deploy finish"# Create serviceaccounts and add the permissions to it. Then make the deployment use it oc create serviceaccount helm -n kube-system oc patch deployment/tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccountName":"helm"}}}}' -n kube-system oc adm policy add-cluster-role-to-user cluster-admin -z helm -n kube-system# Expose helm as nodePort oc expose deployment/tiller-deploy --target-port=tiller --type=NodePort --name=tiller -n kube-system?
?
ericdeMacBook-Pro:add-ons ericnie$ minishift addons install helm Addon 'helm' installed ericdeMacBook-Pro:add-ons ericnie$ minishift addons apply helm -- Applying addon 'helm': "pull start". "deploy start". "deploy finish".... Add into your ~/.bashrc this lines:eval "$(minishift oc-env)"export HELM_HOST="$(minishift ip):$(oc get svc/tiller -o jsonpath='{.spec.ports[0].nodePort}' -n kube-system --as=system:admin)"export MINISHIFT_ADMIN_CONTEXT="default/$(oc config view -o jsonpath='{.contexts[?(@.name=="minishift")].context.cluster}')/system:admin"Initialize the helm client, if not done alreadye.g.helm init -cSearch for an application:e.g.helm searchAnd now deploy an applicatione.g.helm versionTo delete helm tilleroc delete sa/helm deployment/tiller-deploy svc/tiller -n kube-system --as=system:admin以admin:admin登錄后看到tiller部署成功
?
2.客戶端安裝
設置環(huán)境變量
ericdeMacBook-Pro:~ ericnie$ export HELM_HOST="$(minishift ip):$(oc get svc/tiller -o jsonpath='{.spec.ports[0].nodePort}' -n kube-system --as=system:admin)" ericdeMacBook-Pro:~ ericnie$ export MINISHIFT_ADMIN_CONTEXT="default/$(oc config view -o jsonpath='{.contexts[?(@.name=="minishift")].context.cluster}')/system:admin" ericdeMacBook-Pro:~ ericnie$ echo $HELM_HOST 192.168.99.100:30417 ericdeMacBook-Pro:~ ericnie$ echo $MINISHIFT_ADMIN_CONTEXT default/192-168-99-100:8443/system:admin下載helm客戶端
去到網(wǎng)址,找到對應版本下載?
https://github.com/helm/helm/releases?after=v2.8.0
注意需要翻墻 :(
https://storage.googleapis.com/kubernetes-helm/helm-v2.8.1-darwin-amd64.tar.gz
下載然后解壓,加入.bash_profile
ericdeMacBook-Pro:~ ericnie$ cat .bash_profile export CLICOLOR=1 #export PATH=/Users/ericnie/minishift/minishift-1.24.0-darwin-amd64:/Users/ericnie/minishift:$PATH #export PATH="/Users/ericnie/.minishift/cache/oc/v3.10.0/darwin:$PATH"export PATH=/Users/ericnie/bin:$PATH export PATH="/Users/ericnie/.minishift/cache/oc/v3.9.31/darwin:/Users/ericnie/minishift/helm/darwin-amd64:$PATH"export MINISHIFT_USERNAME=eric.nie@163.com export MINISHIFT_PASSWORD=Welcome1$?
ericdeMacBook-Pro:~ ericnie$ helm version Client: &version.Version{SemVer:"v2.8.1", GitCommit:"6af75a8fd72e2aa18a2b278cfe5c7a1c5feca7f2", GitTreeState:"clean"} Server: &version.Version{SemVer:"v2.8.1", GitCommit:"6af75a8fd72e2aa18a2b278cfe5c7a1c5feca7f2", GitTreeState:"clean"}能連上server,會顯示server的版本
?
3.驗證
helm create hello-svc然后把deployment.yaml, service.yaml和values.yaml修改掉
ericdeMacBook-Pro:hello-svc ericnie$ cat templates/deployment.yaml apiVersion: extensions/v1beta1 kind: Deployment metadata:name: {{.Values.deployment_name}} spec:replicas: {{.Values.replicas}}template:metadata:labels:tomcat-app: {{.Values.deployment_name}}version: "1"spec:containers:- name: {{.Values.deployment_name}}image: 172.30.1.1:5000/s2i-tomcat/openshift-tomcat:{{.Values.imageversion}}ports:- containerPort: {{.Values.port}}name: tomcatport?
ericdeMacBook-Pro:hello-svc ericnie$ cat templates/service.yaml apiVersion: v1 kind: Service metadata:name: {{.Values.service_name}}labels:tomcat-app: hellotomcat spec:ports:- port: {{.Values.port}}protocol: TCPtargetPort: 8080name: httptype: NodePortselector:tomcat-app: hellotomcat?
ericdeMacBook-Pro:hello-svc ericnie$ cat values.yaml replicas: 1 deployment_name: hellotomcat service_name: hellotomcat port: 8080 imageversion: latest然后安裝
ericdeMacBook-Pro:hello-svc ericnie$ helm install ./ --namespace s2i-tomcat NAME: austere-mastiff LAST DEPLOYED: Sat Oct 13 11:12:06 2018 NAMESPACE: s2i-tomcat STATUS: DEPLOYEDRESOURCES: ==> v1/Service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE hellotomcat NodePort 172.30.214.212 <none> 8080:30982/TCP 1s==> v1beta1/Deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE hellotomcat 1 0 0 0 0s?
?
4.遇到的問題
minishift ip無法出來
ricdeMacBook-Pro:helm ericnie$ minishift ip Error getting IP: ssh command error: command : ip addr show err : exit status 255 output :?之前遇到過幾次,每次狀況不一樣,這次重新啟動以后就可以了。
?
轉載于:https://www.cnblogs.com/ericnie/p/9781281.html
總結
以上是生活随笔為你收集整理的OpenShift helm的安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SPARK安装一:Windows下Vir
- 下一篇: Android 监控网络状态