DEV Community

Jasper Rodda
Jasper Rodda

Posted on • Updated on

Install Kubernetes Controllers via Operators - ARGO CD

Install Operator

curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.26.0/install.sh | bash -s v0.26.0
Enter fullscreen mode Exit fullscreen mode
  • Install ArgoCD Operator
  • kubectl create -f https://operatorhub.io/install/argocd-operator.yaml
PS C:\WINDOWS\system32> kubectl create -f https://operatorhub.io/install/argocd-operator.yaml
subscription.operators.coreos.com/my-argocd-operator created

Enter fullscreen mode Exit fullscreen mode
  • Verify ArgoCD Operator Installed or not
  • kubectl get csv -n operators
PS C:\WINDOWS\system32> kubectl get csv -n operators
NAME                     DISPLAY   VERSION   REPLACES                 PHASE
argocd-operator.v0.7.0   Argo CD   0.7.0     argocd-operator.v0.6.0   Pending
argocd-operator.v0.7.0   Argo CD   0.7.0     argocd-operator.v0.6.0   Installing
argocd-operator.v0.7.0   Argo CD   0.7.0     argocd-operator.v0.6.0   Succeeded
Enter fullscreen mode Exit fullscreen mode
  • Create ARGOCD Controller: Use manifest to create a new Argo CD cluster

source: ARGOCD documentation

Go to Usage > Basic > save below in argo-cd-manifest.yml

apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
  name: my-argocd
  labels:
    example: basic
spec: {}
Enter fullscreen mode Exit fullscreen mode

Warning: ArgoCD v1alpha1 version is deprecated and will be converted to v1beta1 automatically. Moving forward, please use v1beta1 as the ArgoCD API version.

  • Run Manifest command kubectl apply -f argo-cd-manifest.yml
$ kubectl apply -f argo-cd-manifest.yml
$ kubectl apply -f argoctl.yml
argocd.argoproj.io/my-argocd created
OR 
argocd.argoproj.io/example-argocd created
Enter fullscreen mode Exit fullscreen mode
  • Verify operator pods are created kubectl get pods
PS C:\WINDOWS\system32> kubectl get pods
NAME                                          READY   STATUS    RESTARTS       AGE
my-argocd-application-controller-0       1/1     Running   3              21h
my-argocd-redis-6b8667cdb8-jnmm6         1/1     Running   2 (31m ago)    21h
my-argocd-repo-server-5d547c6f69-mgsnn   1/1     Running   22 (31m ago)   21h
my-argocd-server-bbdf5fdff-ccc2w         1/1     Running   23 (19h ago)   21h
Enter fullscreen mode Exit fullscreen mode
  • Get service server Run list of services kubectl get svc

  • Expose my-argocd-server from ClusterIP to NodePort to access via browser

  • kubectl edit svc my-argocd-server

PS C:\WINDOWS\system32> kubectl edit svc example-argocd-server
service/example-argocd-server edited
Enter fullscreen mode Exit fullscreen mode
PS C:\WINDOWS\system32> kubectl get svc
NAME                            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
example-argocd-metrics          ClusterIP   10.106.206.190   <none>        8082/TCP                     21h
example-argocd-redis            ClusterIP   10.98.228.6      <none>        6379/TCP                     21h
example-argocd-repo-server      ClusterIP   10.104.167.116   <none>        8081/TCP,8084/TCP            21h
example-argocd-server           NodePort    10.108.236.251   <none>        80:30904/TCP,443:31659/TCP   21h
example-argocd-server-metrics   ClusterIP   10.104.220.61    <none>        8083/TCP                     21h
kubernetes                      ClusterIP   10.96.0.1        <none>        443/TCP                      22h
Enter fullscreen mode Exit fullscreen mode
  • Get the list of services and its URL to open in browser minikube service list
PS C:\WINDOWS\system32> minikube service list
|-------------|----------------------------------------------------|--------------|-----------------------------|
|  NAMESPACE  |                        NAME                        | TARGET PORT  |             URL             |
|-------------|----------------------------------------------------|--------------|-----------------------------|
| default     | example-argocd-metrics                             | No node port |                             |
| default     | example-argocd-redis                               | No node port |                             |
| default     | example-argocd-repo-server                         | No node port |                             |
| default     | example-argocd-server                              | http/80      | http://192.168.59.102:30904 |
|             |                                                    | https/443    | http://192.168.59.102:31659 |
| default     | example-argocd-server-metrics                      | No node port |                             |
| default     | kubernetes                                         | No node port |                             |
| default     | spring-boot-app-service                            | http/80      | http://192.168.39.101:30296 |
| kube-system | kube-dns                                           | No node port |                             |
| olm         | operatorhubio-catalog                              | No node port |                             |
| olm         | packageserver-service                              | No node port |                             |
| operators   | argocd-operator-controller-manager-metrics-service | No node port |                             |
|-------------|----------------------------------------------------|--------------|-----------------------------|
Enter fullscreen mode Exit fullscreen mode

Image description

  • Enter: username=admin password=''
  • To get password run
  • kubectl get secret - secret is stored in my-argocd-cluster
  • kubectl edit secret my-argocd-cluster
PS C:\WINDOWS\system32> kubectl get secret
NAME                               TYPE                DATA   AGE
argocd-secret                      Opaque              5      11m
my-argocd-ca                       kubernetes.io/tls   3      11m
my-argocd-cluster                  Opaque              1      11m
my-argocd-default-cluster-config   Opaque              4      11m
my-argocd-tls                      kubernetes.io/tls   2      11m
PS C:\WINDOWS\system32> kubectl edit secret my-argocd-cluster
Enter fullscreen mode Exit fullscreen mode
  • By default, password in store in base64 encoded format, run below command to get password from base64 encode to text
  • convert base64 to plain text
  • echo echo enlkaXd1UEZCNVhoSXJUNGo3UXBvMkpNV2dTdmFaOUU= | base64 -d
  • To reset password to password
#bcrypt(password)=$2a$10$rRyBsGSHK6.uc8fntPwVIuLVHgsAhAX7TcdrqW/RADU0uh7CaChLa
kubectl -n argocd patch secret argocd-secret \
  -p '{"stringData": {
    "admin.password": "$2a$10$rRyBsGSHK6.uc8fntPwVIuLVHgsAhAX7TcdrqW/RADU0uh7CaChLa",
    "admin.passwordMtime": "'$(date +%FT%T%Z)'"
  }}'
Enter fullscreen mode Exit fullscreen mode
PS C:\WINDOWS\system32> kubectl get secret
NAME                                    TYPE                DATA   AGE
argocd-secret                           Opaque              5      22h
example-argocd-ca                       kubernetes.io/tls   3      22h
example-argocd-cluster                  Opaque              1      22h
example-argocd-default-cluster-config   Opaque              4      22h
example-argocd-tls                      kubernetes.io/tls   2      22h
Enter fullscreen mode Exit fullscreen mode

ARGO CD - App configuration:

  • Dashboard

Image description

Top comments (0)