Skip to content

Commit 82b182d

Browse files
committed
Add post on exposing ArgoCD with Istio
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent a045c22 commit 82b182d

File tree

4 files changed

+263
-0
lines changed

4 files changed

+263
-0
lines changed
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
---
2+
layout: post
3+
title: Expose ArgoCD on the Internet with Inlets and Istio
4+
description: Learn how to expose the ArgoCD dashboard on the Internet with Istio and the inlets-operator for Kubernetes.
5+
author: Alex Ellis
6+
tags: argocd istio
7+
category: tutorial
8+
rollup: true
9+
author_img: alex
10+
image: /images/2025-02-argocd-istio/background.png
11+
date: 2025-02-04
12+
---
13+
14+
In this tutorial, you will learn how to expose the ArgoCD dashboard on the Internet with [Istio](https://istio.io/) and the inlets-operator for Kubernetes.
15+
16+
[ArgoCD](https://argo-cd.readthedocs.io/en/stable/) is a popular tool for managing GitOps workflows and deploying applications to Kubernetes. It provides a web-based dashboard that allows you to view the state of your applications, compare them to the desired state, and sync them as needed. Another popular tool for GitOps workflows is [FluxCD](https://fluxcd.io/), which does not ship with a built-in UI, [add-ons are available](https://fluxcd.io/flux/#flux-uis).
17+
18+
If you are running ArgoCD in a private VPC, in your homelab, or on-premises, then the inlets-operator can be used to quickly create a TCP tunnel to expose Istio's Ingress Gateway to the Internet. This will allow you to access the ArgoCD dashboard from anywhere in the world.
19+
20+
![ArgoCD login page exposed via Istio and Inlets](/images/2025-02-argocd-istio/argo-welcome.png)
21+
> ArgoCD login page exposed via Istio and Inlets
22+
23+
A different but related workflow we have seen with inlets tunnels, is where a number of remote Kubernetes clusters are tunneled back to a central Kubernetes cluster. From there, each can be added to ArgoCD and applications can be managed from a central location. This is a great way to manage multiple clusters and applications from a single dashboard. We covered that previously in [How To Manage Inlets Tunnels Servers With Argo CD and GitOps](https://inlets.dev/blog/2022/08/10/managing-tunnel-servers-with-argocd.html).
24+
25+
## Prerequisites
26+
27+
You will need a Kubernetes cluster running in a private network without ingress or Load Balancers. [KinD](https://kind.sigs.k8s.io/), [K3s](https://k3s.io), or [Minikube](https://minikube.sigs.k8s.io/) can be a convenient way to test these steps.
28+
29+
We will install a number of Helm charts and CLIs during the tutorial. For convenience, [arkade](https://arkade.dev) will be used to install these tools, but you are free to install them in whatever way you prefer.
30+
31+
You will also need a domain name under your control where you can create an A record to point to the public IP address of the inlets tunnel server.
32+
33+
Personal and commercial licenses are available from the [inlets website](https://inlets.dev/pricing/) at a similar price to a cloud load balancer service. There are no restrictions on the number of domains that can be exposed over a single tunnel, and the tunnel is hosted in your own cloud account.
34+
35+
## Install the inlets-operator
36+
37+
The inlets-operator looks for LoadBalancer services and in response creates a VM in your cloud account with a public IP address. It then creates a Deployment for the inlets client within the cluster, and updates the LoadBalancer's IP address with the public IP of the inlets server.
38+
39+
From that point, you have a fully working TCP tunnel to your Kubernetes cluster, just like you'd get with a LoadBalancer service from a cloud provider.
40+
41+
To install the inlets-operator with [DigitalOcean](https://m.do.co/c/2962aa9e56a1), create an API token with read/write access and save it to `~/do-access-token`:
42+
43+
```bash
44+
# Create a tunnel in the lon1 region
45+
46+
export DO_REGION=lon1
47+
arkade install inlets-operator \
48+
--provider digitalocean \
49+
--region $DO_REGION \
50+
--access-token-file ~/do-access-token
51+
```
52+
53+
You can find instructions for Helm and other providers like AWS EC2, GCE, Azure, Scaleway, and so forth in the [inlets-operator documentation](https://docs.inlets.dev/reference/inlets-operator/).
54+
55+
Along with the documentation, you can find the [inlets-operator Helm chart](https://github.com/inlets/inlets-operator/tree/master/chart/inlets-operator) on GitHub.
56+
57+
## Install ArgoCD
58+
59+
If you haven't already installed ArgoCD, you can do so with the following command:
60+
61+
```bash
62+
arkade install argocd
63+
```
64+
65+
Now edit the `argocd-server` deployment and turn off its built-in self-signed certificate. We will be obtaining a certificate from Let's Encrypt instead.
66+
67+
```bash
68+
kubectl edit deployment argocd-server -n argocd
69+
```
70+
71+
Add the `--insecure` flag to the `args` section:
72+
73+
```diff
74+
containers:
75+
- args:
76+
- /usr/local/bin/argocd-server
77+
+ - --insecure
78+
```
79+
80+
## Install Istio
81+
82+
Install Istio with the following command:
83+
84+
```bash
85+
arkade install istio
86+
```
87+
88+
## Create a DNS record for the ArgoCD dashboard
89+
90+
Verify the public IP address of the inlets tunnel server:
91+
92+
```bash
93+
$ kubectl get svc -n istio-system istio-ingressgateway
94+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
95+
istio-ingressgateway LoadBalancer 10.43.5.77 144.126.234.124 15021:32412/TCP,80:31062/TCP,443:32063/TCP 51m
96+
```
97+
98+
Next, create a DNS A record from `argocd.example.com` to the public IP address of the inlets tunnel server.
99+
100+
## Install cert-manager
101+
102+
Install cert-manager with the following command:
103+
104+
```bash
105+
arkade install cert-manager
106+
```
107+
108+
## Create a Let's Encrypt Issuer and certificate
109+
110+
The Certificate must be created in the same namespace as the Istio Ingress Gateway, i.e. `istio-system`.
111+
112+
Create a file called `letsencrypt-issuer.yaml` with the following content:
113+
114+
```yaml
115+
export EMAIL="[email protected]"
116+
117+
cat > issuer-prod.yaml <<EOF
118+
apiVersion: cert-manager.io/v1
119+
kind: Issuer
120+
metadata:
121+
name: letsencrypt-prod
122+
namespace: istio-system
123+
spec:
124+
acme:
125+
server: https://acme-v02.api.letsencrypt.org/directory
126+
email: $EMAIL
127+
privateKeySecretRef:
128+
name: letsencrypt-prod
129+
solvers:
130+
- selector: {}
131+
http01:
132+
ingress:
133+
class: istio
134+
EOF
135+
```
136+
137+
Now create a Certificate resource:
138+
139+
```yaml
140+
cat > certificate.yaml <<EOF
141+
export DOMAIN="argocd.example.com"
142+
143+
apiVersion: cert-manager.io/v1
144+
kind: Certificate
145+
metadata:
146+
name: argocd-server-cert
147+
namespace: istio-system
148+
spec:
149+
secretName: argocd-server-tls
150+
commonName: $DOMAIN
151+
dnsNames:
152+
- $DOMAIN
153+
issuerRef:
154+
name: letsencrypt-prod
155+
kind: Issuer
156+
EOF
157+
```
158+
159+
Apply the resources:
160+
161+
```bash
162+
kubectl apply -f letsencrypt-issuer.yaml
163+
kubectl apply -f certificate.yaml
164+
```
165+
166+
## Expose the ArgoCD dashboard
167+
168+
Create a file called `argocd-gateway.yaml` with the following content:
169+
170+
```yaml
171+
cat > gateway.yaml <<EOF
172+
apiVersion: networking.istio.io/v1alpha3
173+
kind: Gateway
174+
metadata:
175+
name: argocd-gateway
176+
namespace: argocd
177+
spec:
178+
selector:
179+
istio: ingressgateway
180+
servers:
181+
- port:
182+
number: 80
183+
name: http
184+
protocol: HTTP
185+
hosts:
186+
- "*"
187+
tls:
188+
httpsRedirect: true
189+
- port:
190+
number: 443
191+
name: https
192+
protocol: HTTPS
193+
hosts:
194+
- "*"
195+
tls:
196+
credentialName: argocd-server-tls
197+
maxProtocolVersion: TLSV1_3
198+
minProtocolVersion: TLSV1_2
199+
mode: SIMPLE
200+
cipherSuites:
201+
- ECDHE-ECDSA-AES128-GCM-SHA256
202+
- ECDHE-RSA-AES128-GCM-SHA256
203+
- ECDHE-ECDSA-AES128-SHA
204+
- AES128-GCM-SHA256
205+
- AES128-SHA
206+
- ECDHE-ECDSA-AES256-GCM-SHA384
207+
- ECDHE-RSA-AES256-GCM-SHA384
208+
- ECDHE-ECDSA-AES256-SHA
209+
- AES256-GCM-SHA384
210+
- AES256-SHA
211+
```
212+
213+
Create a file called `argocd-virtualservice.yaml` with the following content:
214+
215+
```yaml
216+
apiVersion: networking.istio.io/v1alpha3
217+
kind: VirtualService
218+
metadata:
219+
name: argocd-virtualservice
220+
namespace: argocd
221+
spec:
222+
hosts:
223+
- "*"
224+
gateways:
225+
- argocd-gateway
226+
http:
227+
- match:
228+
- uri:
229+
prefix: /
230+
route:
231+
- destination:
232+
host: argocd-server
233+
port:
234+
number: 80
235+
```
236+
237+
Apply the resources:
238+
239+
```bash
240+
kubectl apply -f gateway.yaml
241+
kubectl apply -f virtualservice.yaml
242+
```
243+
244+
## Access the ArgoCD dashboard
245+
246+
At this point you should be able to access the ArgoCD dashboard at `https://argocd.example.com`.
247+
248+
![ArgoCD dashboard exposed via my own domain](/images/2025-02-argocd-istio/argo-dash.png)
249+
> ArgoCD dashboard exposed via my own domain
250+
251+
You can use the command given via `arkade info argocd` to get the initial password for the `admin` user.
252+
253+
## Wrapping up
254+
255+
Exposing an application behind inlets requires no additional effort or changes to the application or configuration itself. It is a drop-in replacement for a cloud LoadBalancer service, and can be used to expose any TCP service running in your Kubernetes cluster.
256+
257+
The majority of the steps we covered were due to the need to turn off the self-signed certificate within ArgoCD, and to obtain a certificate from Let's Encrypt instead. This is a good practice for any application that is exposed to the Internet. The certificates are trusted by most PCs already, are free to obtain, and rotated regularly.
258+
259+
We tend to prefer ingress-nginx for its simplicity and ease of use. The ArgoCD covers how to use ingress-nginx and other Ingress controllers: [Docs: ArgoCD Ingress Configuration](https://argo-cd.readthedocs.io/en/latest/operator-manual/ingress/).
260+
261+
[Arkade](https://github.com/alexellis/arkade) was used to install various Helm charts and CLIs purely for brevity, but you can use whatever tools you prefer to install them including Helm, brew or curl.
262+
263+
If you are interested in learning more about inlets, check out the [inlets documentation](https://docs.inlets.dev/) or [reach out to talk to us](https://inlets.dev/contact/).
159 KB
Loading
217 KB
Loading
61.5 KB
Loading

0 commit comments

Comments
 (0)