OpenShift helm的安装

Posted ericnie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenShift helm的安装相关的知识,希望对你有一定的参考价值。

1.安装过程

下载addons的代码

$ git clone https://github.com/jorgemoralespou/minishift-addons
$ cd minishift-addons

因为helm的tiller要求访问gcr的地址,因此把地址替换成ericnie2017后建立

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.1

echo "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-refresh

echo "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 already

e.g.
  helm init -c

Search for an application:

e.g.
  helm search

And now deploy an application

e.g.
  helm version

To delete helm tiller
  oc delete sa/helm deployment/tiller-deploy svc/tiller -n kube-system --as=system:admin

以admin:admin登录后看到tiller部署成功

技术分享图片

 

2.遇到问题

minishift ip无法出来

ricdeMacBook-Pro:helm ericnie$ minishift ip
Error getting IP: ssh command error:
command : ip addr show
err     : exit status 255
output  :

 

以上是关于OpenShift helm的安装的主要内容,如果未能解决你的问题,请参考以下文章

OpenShift 4.3环境中创建基于Go的Operator

Helm2和Helm3的安装卸载常用命令

openshift 3.11 安装部署

k8s 安装helm

helm2和helm3的区别及helm2的安装使用

RHEL7.4安装openshift