Offline installation spinnaker to K8S cluster

Foreword

Spinnaker is open source Netflix in 2015, a sustained delivery platform, originally developed by Netflix developed for fast and reliable publishing software changes. Spinnaker so that developers can more easily focus on writing code without worrying about the underlying cloud infrastructure, and it can Jenkins and other popular build tool seamlessly integrated. However, due to GFW led Spinnaker very difficult to deploy in the country, of course, you can use a proxy, but this does not match with the original intention of this article. After several attempts, finally installed spinnaker without the use of agents, ado, directly to the question.

Installation Halyard

Use docker mounted Halyard.

# useradd spinnaker
# cd /home/spinnaker
$ mkdir ~/.hal
$ docker run -d -p 8084:8084 -p 9000:9000 --name halyard --rm  -v ~/.hal:/home/spinnaker/.hal -v ~/.kube:/home/spinnaker/.kube -it gcr.azk8s.cn/spinnaker-marketplace/halyard:1.31.1

Start Parameters: /home/spinnaker/.hal directory halyard configuration file, / home / spinnaker / .kube to k8s cluster certification directory.
Mirroring the official website address given gcr.io in the country is not accessible, the mirror needs to be modified to address gcr.azk8s.cn.

Spinnaker Preparation Before Installation

spinnaker deployment environment There are three:

  • In k8s distributed installation (recommended)
  • Local single machine installation
  • Local install git
    used herein K8S way.
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0",GitCommit:"xxx", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.8-xx.1", GitCommit:"51888f5", GitTreeState:"", BuildDate:"2019-10-16T08:29:13Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl create namespace spinnaker

Configuration profiles spinnaker
main mirror disposed docker storage and storage, the following example configuration file.

currentDeployment: default
deploymentConfigurations:
- name: default
  version: local:1.17.6
  providers:
    appengine:
      enabled: false
      accounts: []
    aws:
      enabled: false
      accounts: []
      bakeryDefaults:
        baseImages: []
      defaultKeyPairTemplate: '{{name}}-keypair'
      defaultRegions:
      - name: huabei2
      defaults:
        iamRole: BaseIAMRole
    ecs:
      enabled: false
      accounts: []
    azure:
      enabled: false
      accounts: []
      bakeryDefaults:
        templateFile: azure-linux.json
        baseImages: []
    dcos:
      enabled: false
      accounts: []
      clusters: []
    dockerRegistry:
      enabled: true
      accounts:
      # 镜像仓库地址
      - name: dockerhub
        requiredGroupMembership: []
        providerVersion: V1
        permissions: {}
        # 你的镜像仓库地址
        address: xxxx
        # 镜像仓库认证
        username: xxxxx
        password: xxxxx
        email: [email protected]
        sortTagsByDate: true
        repositories:
        # 此处是你的namespace下的项目
        - namespace/appname
      # 镜像仓库地址
      primaryAccount: dockerhub
    google:
      enabled: false
      accounts: []
      bakeryDefaults:
        templateFile: gce.json
        baseImages: []
        zone: us-central1-f
        network: default
        useInternalIp: false
    huaweicloud:
      enabled: false
      accounts: []
      bakeryDefaults:
        baseImages: []
    kubernetes:
      enabled: true
      accounts:
      # 此处为k8s集群名称
      - name: k8s
        requiredGroupMembership: []
        providerVersion: V2
        permissions: {}
        dockerRegistries: []
        configureImagePullSecrets: true
        cacheThreads: 1
        namespaces:
        # 此处把你的namespace 加进去
        - yournamespace  
        omitNamespaces: []
        kinds: []
        omitKinds: []
        customResources: []
        cachingPolicies: []
        # 此处为k8s集群认证文件地址
        kubeconfigFile: /home/spinnaker/.kube/config
        oAuthScopes: []
        onlySpinnakerManaged: false
      # 与k8s集群名称一致
      primaryAccount: k8s
    oracle:
      enabled: false
      accounts: []
      bakeryDefaults:
        templateFile: oci.json
        baseImages: []
    cloudfoundry:
      enabled: false
      accounts: []
  deploymentEnvironment:
    size: SMALL
    type: Distributed
    # k8s集群名称
    accountName: k8s
    imageVariant: SLIM
    updateVersions: false
    consul:
      enabled: false
    vault:
      enabled: false
    customSizing: {}
    sidecars: {}
    initContainers: {}
    hostAliases: {}
    affinity: {}
    tolerations: {}
    nodeSelectors: {}
    gitConfig:
      upstreamUser: spinnaker
    livenessProbeConfig:
      enabled: false
    haServices:
      clouddriver:
        enabled: false
        disableClouddriverRoDeck: false
      echo:
        enabled: false
  persistentStorage:
    # 此处配置存储,示例为s3
    persistentStoreType: s3
    azs: {}
    gcs: {} 
    redis: {}
    # s3存储的认证信息
    s3:
      bucket: xxx
      rootFolder: xxx
      region: xxx
      pathStyleAccess: false
      accessKeyId: xxx
      secretAccessKey:  xxx
    oracle: {}
  features:
    auth: false
    fiat: false
    chaos: false
    entityTags: false
    pipelineTemplates: true
    artifacts: true
  metricStores:
    datadog:
      enabled: false
      tags: []
    prometheus:
      enabled: false
      add_source_metalabels: true
    stackdriver:
      enabled: false
    newrelic:
      enabled: false
      tags: []
    period: 30
    enabled: false
  notifications:
    slack:
      enabled: false
    twilio:
      enabled: false
      baseUrl: https://api.twilio.com/
    github-status:
      enabled: false
  timezone: Asia/Shanghai
  ci:
    jenkins:
      enabled: false
      masters: []
    travis:
      enabled: false
      masters: []
    wercker:
      enabled: false
      masters: []
    concourse:
      enabled: false
      masters: []
    gcb:
      enabled: false
      accounts: []
  repository:
    artifactory:
      enabled: false
      searches: []
  security:
    apiSecurity:
      ssl:
        enabled: false
      # gate地址  
      overrideBaseUrl: https://spin-gate.xxx.com
    uiSecurity:
      ssl:
        enabled: false
      # deck地址  
      overrideBaseUrl: https://spinnaker.xxx.com
    authn:
      oauth2:
        enabled: false
        client: {}
        resource: {}
        userInfoMapping: {}
      saml:
        enabled: false
        userAttributeMapping: {}
      ldap:
        enabled: false
      x509:
        enabled: false
      iap:
        enabled: false
      enabled: false
    authz:
      groupMembership:
        service: FILE
        google:
          roleProviderType: GOOGLE
        github:
          roleProviderType: GITHUB
        file:
          roleProviderType: FILE
        ldap:
          roleProviderType: LDAP
      enabled: true
  artifacts:
    bitbucket:
      enabled: false
      accounts: []
    gcs:
      enabled: false
      accounts: []
    oracle:
      enabled: false
      accounts: []
    github:
      enabled: false
      accounts: []
    gitlab:
      enabled: true
      accounts:
      - name: gitlab
        token: xxx
    gitrepo:
      enabled: false
      accounts: []
    http:
      enabled: false
      accounts: []
    helm:
      enabled: false
      accounts: []
    s3:
      enabled: false
      accounts: []
    maven:
      enabled: false
      accounts: []
    templates: []
  pubsub:
    enabled: false
    google:
      enabled: false
      pubsubType: GOOGLE
      subscriptions: []
      publishers: []
  canary:
    enabled: false
    serviceIntegrations:
    - name: google
      enabled: false
      accounts: []
      gcsEnabled: false
      stackdriverEnabled: false
    - name: prometheus
      enabled: false
      accounts: []
    - name: datadog
      enabled: false
      accounts: []
    - name: signalfx
      enabled: false
      accounts: []
    - name: aws
      enabled: false
      accounts: []
      s3Enabled: false
    - name: newrelic
      enabled: false
      accounts: []
    reduxLoggerEnabled: true
    defaultJudge: NetflixACAJudge-v1.0
    stagesEnabled: true
    templatesEnabled: true
    showAllConfigsEnabled: true
  plugins:
    plugins: []
    enabled: false
    downloadingEnabled: false
  spinnaker:
    extensibility:
      repositories: {}
  webhook:
    trust:
      enabled: false
  telemetry:
    enabled: false
    endpoint: https://stats.spinnaker.io
    instanceId: xxx
    connectionTimeoutMillis: 3000
    readTimeoutMillis: 5000

Local installation spinnaker
operation next is particularly important, we use the local installation, you need to bom to local, install version 1.17.6.

$ pwd
/home/spinnaker
$ mkdir ~/.hal/.boms/bom -p
$ cd  ~/.hal/.boms/bom
$ more 1.17.6.yml
version: 1.17.6
timestamp: '2020-01-14 08:44:42'
services:
  echo:
    version: local:2.9.1-20191216151527
    commit: 771a15b2b7bd8d78f77caf3c3ecff950e187c1ae
  clouddriver:
    version: local:6.4.5-20200114034416
    commit: 5f272cd8d3911423dfcf7e9448c31fe4aa045e2e
  deck:
    version: local:2.13.5-20200114034416
    commit: 75cecc4cf1d52ff78fb1fb5e057b516c51be10fb
  fiat:
    version: local:1.8.3-20191202102650
    commit: c62d038c2a9531042ff33c5992384184b1370b27
  front50:
    version: local:0.20.1-20191107034416
    commit: 9415a443b0d6bf800ccca8c2764d303eb4d29366
  gate:
    version: local:1.13.0-20191029172246
    commit: a453541b47c745a283712bb240ab392ad7319e8d
  igor:
    version: local:1.7.0-20191029183208
    commit: 37fe1ed0c463bdaa87996a4d4dd81fee2325ec8e
  kayenta:
    version: local:0.12.0-20191023142816
    commit: 5dcec805b7533d0406f1e657a62122f4278d665d
  orca:
    version: local:2.11.2-20191212093351
    commit: b88f62a1b2b1bdee0f45d7f9491932f9c51371d9
  rosco:
    version: local:0.15.1-20191202163249
    commit: 269dc830cf7ea2ee6c160163e30d6cbd099269c2
  defaultArtifact: {}
  monitoring-third-party:
    version: local:0.16.0-20191007112816
    commit: 59cbbec589f982864cee45d20c99c32d39c75f7f
  monitoring-daemon:
    version: local:0.16.0-20191007112816
    commit: 59cbbec589f982864cee45d20c99c32d39c75f7f
dependencies:
  redis:
    version: 2:2.8.4-2
  consul:
    version: 0.7.5
  vault:
    version: 0.7.0
artifactSources:
  debianRepository: https://dl.bintray.com/spinnaker-releases/debians
  dockerRegistry: gcr.azk8s.cn/spinnaker-marketplace
  googleImageProject: marketplace-spinnaker-release
  gitPrefix: https://github.com/spinnaker

Two things to note bom profile, the former version need to add local, mirroring the replacement address for domestic addresses!
After configuration is complete, hal will not deploy in time to google pull configuration versions, but read from the local to echo, for example, reads the local directory ~ / .hal / .boms / echo / echo.yml, so we will need to download the appropriate file to the local yml the appropriate directory.
Download: https://github.com/spinnaker
to echo, for example, download the file to https://github.com/spinnaker/echo/tree/master/halconfig file in, and placed in the local directory ~ / .hal /.boms/echo next.
After downloading the directory structure is as follows:

├── bom/
│   ├── 1.17.6.yml
├── clouddriver/
│   ├── clouddriver.yml
│   └── ...
├── deck/
│   ├──    settings.js
.......

Formal deployment spinnaker

Completed the basic work, you can have fun (agentless) the deployment of the spinnaker.

# 设置hal使用本地文件系统的bom斑斑
$ hal config version edit --version local:1.17.6
$hal deploy apply
+ Get current deployment
  Success
+ Prep deployment
  Success
Problems in default.security:
- WARNING Your UI or API domain does not have override base URLs
  set even though your Spinnaker deployment is a Distributed deployment on a
  remote cloud provider. As a result, you will need to open SSH tunnels against
  that deployment to access Spinnaker.
? We recommend that you instead configure an authentication
  mechanism (OAuth2, SAML2, or x509) to make it easier to access Spinnaker
  securely, and then register the intended Domain and IP addresses that your
  publicly facing services will be using.

+ Preparation complete... deploying Spinnaker
+ Get current deployment
  Success
+ Apply deployment
  Success
+ Deploy spin-redis
  Success
+ Deploy spin-clouddriver
  Success
+ Deploy spin-front50
  Success
+ Deploy spin-orca
  Success
+ Deploy spin-deck
  Success
+ Deploy spin-echo
  Success
+ Deploy spin-gate
  Success
+ Deploy spin-rosco
  Success
+ Deploy spin-igor
  Success
+ Run `hal deploy connect` to connect to Spinnaker.

View deployment spinnaker in k8s in:

# kubens spinnaker
Context "xxxx" modified.
Active namespace is "spinnaker".
# kubectl get pods
NAME                                READY   STATUS    RESTARTS   AGE
spin-clouddriver-7fb74cf5c6-c7g87   1/1     Running   0          10m
spin-deck-76b4df7b48-nnj8x          1/1     Running   0          10m
spin-echo-cccf9f7db-bn6t5           1/1     Running   0          10m
spin-fiat-7dc9547ff5-jqw7l          1/1     Running   0          10m
spin-front50-5744455478-qmg2x       1/1     Running   0          10m
spin-gate-6bbb57846c-tplqg          1/1     Running   0          10m
spin-igor-74bfbc6c57-xtbb8          1/1     Running   0          10m
spin-orca-78dc9844cb-6w4ww          1/1     Running   0          10m
spin-redis-6bf56c789c-lbq6l         1/1     Running   0          10m
spin-rosco-664b65f8d6-6n58m         1/1     Running   0          10m

Configuration ingress
configuration ingress access spinnaker.

$ more spinnaker-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: spinnaker
  namespace: spinnaker
  annotations:
    kubernetes.io/ingress.class: web
    nginx.ingress.kubernetes.io/ssl-redirect: "true"

spec:
  tls:
    - secretName: ingress-niucache
      hosts:
        - spinnaker.xxx.com
        - spin-gate.xxx.com
  rules:
    - host: spinnaker.xxx.com
      http:
        paths:
        - path: /
          backend:
            serviceName: spin-deck
            servicePort: 9000
    - host: spin-gate.xxx.com
      http:
        paths:
        - path: /
          backend:
            serviceName: spin-gate
            servicePort: 8084
# kubectl get ingress
NAME        HOSTS                                           ADDRESS                         PORTS     AGE
spinnaker   spinnaker.xxx.com,spin-gate.xxx.com   xx  80, 443   10m            

Access spinnaker
after the domain name will resolve to do to access the spinnaker.

At this point, spinnaker installation is complete!

postscript

In order to bypass GW installed spinnaker, took great pains in order to make a record, and share with a friend in need. The caption offline installation, not a true off-line, meaning agentless, but also need an Internet connection to download the image, but if you have a mirror image in the local repository, it can be truly taken offline. This article describes the spinnaker just installed, does not mention the use of, personally feel spinnaker hardest thing to install, use it, we can refer to the official documentation, very detailed, if in the future there is a need, and then add a document to use it.

Guess you like

Origin www.cnblogs.com/aresxin/p/spinnaker-install.html