Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Latest commit

 

History

History
101 lines (83 loc) · 3.99 KB

kubernetes.md

File metadata and controls

101 lines (83 loc) · 3.99 KB

How to deploy Codefresh application on Azure Kubernetes Service (AKS) cluster

Pre-requisites

  • The Azure CLI version 2.0.46 or later. az --version to check installed version.
  • The kubectl binary version 1.10+ . kubectl version to check installed version.

AKS cluster deployment

  1. Make az login if needed
  2. Create a resource group
az group create --name onprem-aks-rg --location centralus
  1. Get available Kubernetes versions
az aks get-versions --location centralus -otable
  1. Create AKS cluster
az aks create --resource-group onprem-aks-rg --name onprem-aks --kubernetes-version 1.11.3 --node-count 1 --node-vm-size Standard_DS2_v2 --node-osdisk-size 128 --enable-addons monitoring --admin-username ubuntu --ssh-key-value <path_to_ssh_public_key>
  1. Get and configure kubernetes cluster credentials
az aks get-credentials --resource-group onprem-aks-rg --name onprem-aks --admin
  1. Check out your current context
kubectl config current-context

Register Codefresh app in a git provider

  1. Define your CF app URL: example https://onprem-aks.codefresh.io

  2. Register CF application on git provider side. The procedure is described in this document

  3. Write down Client ID, Client Secret, git provider URL.

Deploy Codefresh app

  1. Clone onprem repository
git clone [email protected]:codefresh-io/onprem.git
cd onprem
  1. Download values.yaml and sa.json files from 1Password into current ./onprem directory. When logged in search for onprem in devops-shared vault.

  2. Make configuration changes in sa-dec.json, values.yaml files.

  • sa.json contains GCP service account that enables a customer to pull codefresh images (created in GCP codefres-enterprise project )
  • values.yaml set CF application domain name, git provider domain name, secrets such as githubClientID, githubClientSecret, or gitlabClientID, gitlabClientSecret etc.
  1. Give a node local-volume label
kubectl get node

kubectl label nodes <NODENAME> provisioner=local-volume

  1. Run cf-onprem script
sudo ./cf-onprem

To run the script in non-interactive mode use -y|--yes argument:

sudo ./cf-onprem -y
  1. Wait for CF App to be deployed
watch kubectl -ncodefresh get pods
  1. Get ingress service ip address
kubectl -ncodefresh get svc | grep ingress-controller
  1. Register CF application URL with ip addrees at Cloudflare.com (or other domain name registrar)
  2. Open web browser and go to the CF application URL (ex. https://onprem-aks.codefresh.io)
  3. Log in with ON PREMISE CODEFRESH credentials.
  4. Go to Admin Management --> IDPs.
  5. Edit your git provider with git provider domain name and then Log Out.
  6. Wait for several minutes and Sign up with chosen git provider.
  7. Go to Integrations --> Git --> Congifure --> ADD GIT PROVIDER and configure it. Git providers document can help.
  8. Log in with ON PREMISE CODEFRESH credentials once again, Go to Admin Management --> Users and add Admin role for your user if needed. Go to Admin Management --> Nodes and ensure cfapi is up and has running status. If not it is needed to restart cfapi pod
kubectl -ncodefresh get pod | grep cfapi
kubectl -ncodefresh delete pod <cfapi-pod-name>
  1. Sign in with your git provider.
  2. Add Repository. 18.Click BUILD

How to deploy CF application with custom certificate

  1. Uncomment webTLS keys in values.yaml.
  2. Define custom TLS certificate and private key location and put them there.
  3. Run cf-onprem script with parameters:
sudo ./cf-onprem --web-tls-key <path-to-private-key-file> --web-tls-cert <path-to-full-certificate-chain-file>