Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log & Monitor
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
  • Toggle search form

[Spinnaker-Github-Helm-K8S]Hướng dẫn cấu hình Spinnaker deploy lên kubernetes dựa vào Helm

Posted on June 8, 2021September 12, 2021 By nim No Comments on [Spinnaker-Github-Helm-K8S]Hướng dẫn cấu hình Spinnaker deploy lên kubernetes dựa vào Helm

Hướng dẫn cấu hình Spinnaker deploy lên kubernetes dựa vào Helm.

Tạo Helm Chart theo hướng dẫn: 

  • https://phoenixnap.com/kb/create-helm-chart
  • https://docs.bitnami.com/tutorials/create-your-first-helm-chart/
  • https://tel4vn.edu.vn/blog/how-to-create-heml-chart-in-10-minutes/ (tài liệu tiếng việt)

Thực package helm bằng câu lệnh: helm package ./mychart

>>>>câu lệnh tạo 1 helm chart
helm create phoenixnap

>>>>.thực hiện sửa 1 số config theo như hướng dẫn https://phoenixnap.com/kb/create-helm-chart

>>>>> thực hiện chạy câu lệnh để deploy lên k8s thử
helm install phoenix-chart phoenixnap/ --values phoenixnap/values.yaml

>>>>>
kubectl get all
kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services phoenix-chart
kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}"

export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services phoenix-chart)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
>>>>>nhưng câu lệnh trên chỉ dùng để giúp bạn biết đường links để truy cập vào service được 

helm package ./phoenixnap

Thực hiện create repo trên github và push github:

https://github.com/mrnim94/kubernetes-manifest.git

Thực hiện token trên github:

Sau khi có được token thực hiện enable-artifacts github

Thực hiện script này:

ubuntu@spinnaker-u16:~$ cat spinnaker-course/kubernetes/scripts/enable-artifacts.sh
#!/bin/bash
TOKEN_FILE=~/github-token
ARTIFACT_ACCOUNT_NAME=my-github-artifact-account

if [ ! -e "$TOKEN_FILE" ] ; then
  echo "token file does not exist"
  exit 1
fi

hal config features edit --artifacts true
hal config artifact github enable
hal config artifact github account add $ARTIFACT_ACCOUNT_NAME \
    --token-file $TOKEN_FILE

# webhook address: http://ip:8084/webhooks/git/github

Nhìn vào script trên chúng ta cần tạo file github-token và dán token github vào đây.

Sau khi chạy xong script thì chạy lệnh sau để apply:

sudo hal deploy apply

Thực hiện taọ manual 1 pipeline:

Ta quan tạo Get Manifest mực địch để lấy manifest để của deployment trước đó

Ví khi tạo 1 deployment mới thì nó giữ nguyên số re từ deploymet cũ đến deployment mới.

Giờ đến bước gen manifest bằng helm

Ở phần content URL sẽ có số chú ý:

Chỗ này ta cần chỉ tới file package của helm:

Trên ulr sẽ ta copy được như thế này:

https://github.com/mrnim94/kubernetes-manifest/blob/master/phoenixnap-0.1.0.tgz

Được link chúng ta cần lấy để vào spinnaker là:

https://api.github.com/repos/mrnim94/kubernetes-manifest/contents/phoenixnap-0.1.0.tgz

Tự loại compare và tạo nhé!

Thực hiên Overrides các thông số của helm chart theo các ta muốn.

Thông qua file value:

Thực hiện như trên:

Nội dung trong url

https://api.github.com/repos/mrnim94/kubernetes-manifest/contents/generic/values.yaml

 File này có thể lưu trư trên s3 của aws hay google luôn nhé.

Hoặc overrides theo dạng key value

Ở đây chúng muốn giữ replicaCount như deployment trước đó:

replicaCount

${ #stage(“Get Manifest”).context[“manifest”][“spec”][“replicas”] }

Lăn xuống dưới chúng ta sẽ tạo file manifest cho bước sau để deploy thực hiện đặt tên lại cho đẹp:

Thực hiện bược deployment

Xong òi click export thành template hay copy json

Giờ ấn run và kiểm tra thôi

Giờ bạn muốn sem lại file manifest của spinnaker gen ra dựa vào helm ntn

CI/CD, Spinnaker

Post navigation

Previous Post: [Jenkins] Hướng dẫn sử dụng Jenkins pipeline to control Jenkins agent in k8s and deploy on k8s
Next Post: [Helm Chart] Learning Helm on Kubernetes in 60 minutes!!

More Related Articles

[Argo Rollouts] How We Brought Automated Rollback to 2100+ Micro-serv… CI/CD
[Spinnaker] Spin CLI Spinnaker
[Kaniko/Jenkins] Install Jenkins through helm and build/deploy app in K8s by Kaniko CI/CD
[ArgoCD] Sử dụng ArgoCD deploy lên k8s. ArgoCD
[Spinnaker] Design CD on Kubernetes by Spinnaker Spinnaker
[TeamCity] Getting started with TeamCity CI/CD

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Smartctl] Instruction check the health disk of Raspberry. January 16, 2023
  • [kubectl/Argocd] How to create a kubectl config file for serviceaccount or from the cluster secret of Argocd January 12, 2023
  • [Helm/Github] Create a public Helm chart repository with GitHub Pages January 8, 2023
  • [AWS] How to increase the disk size of a Windows EC2 machine? January 4, 2023
  • [Redis] ElastiCache-Redis Cross-Region Replication|Global DataStore January 3, 2023

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.