kubernetes 1.7.5上安装fabric8

参考链接:
https://fabric8.io/
https://github.com/fabric8io

1. 下载gofabric8

地址:https://github.com/fabric8io/gofabric8/releases
通过测试的版本 version:0.4.157

2. fabric8安装需要使用pvc,所以配置StorageClass ,使用nfs

参考:http://blog.xianshiyue.com/216

3. 安装gofabric8

mkdir $HOME/.fabric8/bin
cp gofabric8-linux-amd64 gofabric8-linux-amd64
mv gofabric8-linux-amd64 gofabric8
export PATH=$PATH:$HOME/.fabric8/bin

4. 开始部署fabric8

gofabric8 deploy -y -d xianshiyue.com --namespace=fabric8

部署的过程中注意查看运行的pods,有些镜像下载很慢可以手动下载,可以去阿里云下载,然后 docker tag
https://dev.aliyun.com/list.html?namePrefix=kube

5. 给 fabric8 命令空间下的 serviceaccount 授权

检查pods 的运行状态都是running,但是还是无法访问,检查pods 的日志,发现 exposecontrollerconfigmapcontroller 无权访问kubernetes 的api, 我自己用了一个粗暴的方式,给命令空间下所有的 serviceaccount 授权,包括 default
eg:

kubectl create clusterrolebinding exposecontroller-cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=fabric8:exposecontroller

kubectl create clusterrolebinding configmapcontroller-cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=fabric8:configmapcontroller

kubectl create clusterrolebinding default-cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=fabric8:default

kubectl create clusterrolebinding fabric8-cluster-admin-binding --clusterrole=cluster-admin --serviceaccount=fabric8:fabric8

6. 修改deployment ingress-nginx 的配置

6.1 导出yaml配置文件

kubectl get deployments ingress-nginx  -nfabric8 -o yaml >> ingress-nginx.yaml

6.2 修改配置文件

把pods网络模式设置成 host,只需要添加 hostNetwork: true
eg:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    configmap.fabric8.io/update-on-change: nginx-config
    deployment.kubernetes.io/revision: "3"
    fabric8.io/git-branch: release-v2.2.311
    fabric8.io/git-commit: 2b9f7ce19493fe6d18392ac4f4be16f5e1a76fa3
    fabric8.io/iconUrl: https://cdn.rawgit.com/fabric8io/fabric8-devops/master/ingress-nginx/src/main/fabric8/icon.png
    fabric8.io/metrics-path: dashboard/file/kubernetes-pods.json/?var-project=ingress-nginx&var-version=2.2.311
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"extensions/v1beta1","kind":"Deployment","metadata":{"annotations":{"configmap.fabric8.io/update-on-change":"nginx-config","deployment.kubernetes.io/revision":"2","fabric8.io/git-branch":"release-v2.2.311","fabric8.io/git-commit":"2b9f7ce19493fe6d18392ac4f4be16f5e1a76fa3","fabric8.io/iconUrl":"https://cdn.rawgit.com/fabric8io/fabric8-devops/master/ingress-nginx/src/main/fabric8/icon.png","fabric8.io/metrics-path":"dashboard/file/kubernetes-pods.json/?var-project=ingress-nginx\u0026var-version=2.2.311"},"creationTimestamp":"2017-10-23T14:45:38Z","generation":2,"labels":{"group":"io.fabric8.devops.apps","project":"ingress-nginx","provider":"fabric8","version":"2.2.311"},"name":"ingress-nginx","namespace":"fabric8","resourceVersion":"3294","selfLink":"/apis/extensions/v1beta1/namespaces/fabric8/deployments/ingress-nginx","uid":"d5bb1ec8-b800-11e7-a179-00163e0c10a2"},"spec":{"replicas":1,"selector":{"matchLabels":{"group":"io.fabric8.devops.apps","project":"ingress-nginx","provider":"fabric8"}},"strategy":{"rollingUpdate":{"maxSurge":1,"maxUnavailable":1},"type":"RollingUpdate"},"template":{"metadata":{"annotations":{"configmap.fabric8.io/update-on-change":"nginx-config","fabric8.io/git-branch":"release-v2.2.311","fabric8.io/git-commit":"2b9f7ce19493fe6d18392ac4f4be16f5e1a76fa3","fabric8.io/iconUrl":"https://cdn.rawgit.com/fabric8io/fabric8-devops/master/ingress-nginx/src/main/fabric8/icon.png","fabric8.io/metrics-path":"dashboard/file/kubernetes-pods.json/?var-project=ingress-nginx\u0026var-version=2.2.311"},"creationTimestamp":null,"labels":{"group":"io.fabric8.devops.apps","project":"ingress-nginx","provider":"fabric8","version":"2.2.311"}},"spec":{"containers":[{"args":["-v=3","-nginx-configmaps=fabric8-system/nginx-config"],"env":[{"name":"FABRIC8_NGINX_CONFIG_CONFIGMAP","value":"client-max-body-size=2000m;proxy-connect-timeout=500s;proxy-read-timeout=500s;server-names-hash-bucket-size=256;server-names-hash-max-size=1024"}],"image":"nginxdemos/nginx-ingress:0.3.1","imagePullPolicy":"IfNotPresent","name":"nginx-ingress","ports":[{"containerPort":80,"hostPort":80,"name":"http","protocol":"TCP"},{"containerPort":443,"hostPort":443,"name":"https","protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File"}],"dnsPolicy":"ClusterFirst","hostNetwork":true,"nodeSelector":{"fabric8.io/externalIP":"true"},"restartPolicy":"Always","schedulerName":"default-scheduler","securityContext":{},"terminationGracePeriodSeconds":30}}},"status":{"availableReplicas":1,"conditions":[{"lastTransitionTime":"2017-10-23T14:45:38Z","lastUpdateTime":"2017-10-23T14:45:38Z","message":"Deployment has minimum availability.","reason":"MinimumReplicasAvailable","status":"True","type":"Available"}],"observedGeneration":2,"readyReplicas":1,"replicas":1,"updatedReplicas":1}}
  creationTimestamp: 2017-10-23T14:45:38Z
  generation: 3
  labels:
    group: io.fabric8.devops.apps
    project: ingress-nginx
    provider: fabric8
    version: 2.2.311
  name: ingress-nginx
  namespace: fabric8
  resourceVersion: "3872"
  selfLink: /apis/extensions/v1beta1/namespaces/fabric8/deployments/ingress-nginx
  uid: d5bb1ec8-b800-11e7-a179-00163e0c10a2
spec:
  replicas: 1
  selector:
    matchLabels:
      group: io.fabric8.devops.apps
      project: ingress-nginx
      provider: fabric8
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      annotations:
        configmap.fabric8.io/update-on-change: nginx-config
        fabric8.io/git-branch: release-v2.2.311
        fabric8.io/git-commit: 2b9f7ce19493fe6d18392ac4f4be16f5e1a76fa3
        fabric8.io/iconUrl: https://cdn.rawgit.com/fabric8io/fabric8-devops/master/ingress-nginx/src/main/fabric8/icon.png
        fabric8.io/metrics-path: dashboard/file/kubernetes-pods.json/?var-project=ingress-nginx&var-version=2.2.311
      creationTimestamp: null
      labels:
        group: io.fabric8.devops.apps
        project: ingress-nginx
        provider: fabric8
        version: 2.2.311
    spec:
      containers:
      - args:
        - -v=3
        - -nginx-configmaps=fabric8/nginx-config
        image: nginxdemos/nginx-ingress:0.3.1
        imagePullPolicy: IfNotPresent
        name: nginx-ingress
        ports:
        - containerPort: 80
          hostPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          hostPort: 443
          name: https
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      hostNetwork: true             ##=> 添加这一行
      nodeSelector:
        fabric8.io/externalIP: "true"
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: 2017-10-23T14:45:38Z
    lastUpdateTime: 2017-10-23T14:45:38Z
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  observedGeneration: 3
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

6.3 删除原来的deployment, 应用修改后的配置

kubectl delete -f ingress-nginx.yaml
kubectl create -f ingress-nginx.yaml

这个时候访问 配置的域名 http://xianshiyue.com 已经可以成功进入到控制台了

7. 最后修改 ingress-nginx 的configmap

如果域名配置太长的话,service自动生成域名部署到nginx中将会报错,按照下图修改就OK

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,793评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,567评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,342评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,825评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,814评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,680评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,033评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,687评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,175评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,668评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,775评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,419评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,020评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,978评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,206评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,092评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,510评论 2 343

推荐阅读更多精彩内容