|
| 1 | +// Module is included in the following assemblies: |
| 2 | +// |
| 3 | +// * /cicd/gitops/configuring-secure-communication-with-redis.adoc |
| 4 | + |
| 5 | +[id="gitops-configuring-tls-for-redis-with-autotls-disabled_{context}"] |
| 6 | += Configuring TLS for Redis with autotls disabled |
| 7 | + |
| 8 | +You can manually configure TLS encryption for Redis by creating the `argocd-operator-redis-tls` secret with a key and certificate pair. In addition, you must annotate the secret to indicate that it belongs to the appropriate Argo CD instance. The steps to create a certificate and secret vary for instances with High Availability (HA) enabled. |
| 9 | + |
| 10 | +.Procedure |
| 11 | + |
| 12 | +. Log in to the {product-title} web console. |
| 13 | + |
| 14 | +. Create an Argo CD instance: |
| 15 | + |
| 16 | +.. In the *Administrator* perspective of the web console, use the left navigation panel to go to *Administration* -> *CustomResourceDefinitions*. |
| 17 | + |
| 18 | +.. Search for `argocds.argoproj.io` and click `ArgoCD` custom resource definition (CRD). |
| 19 | + |
| 20 | +.. On the *CustomResourceDefinition details* page, click the *Instances* tab, and then click *Create ArgoCD*. |
| 21 | + |
| 22 | +.. Edit or replace the YAML similar to the following example: |
| 23 | ++ |
| 24 | +.Example ArgoCD CR with autotls disabled |
| 25 | +[source,yaml] |
| 26 | +---- |
| 27 | +apiVersion: argoproj.io/v1alpha1 |
| 28 | +kind: ArgoCD |
| 29 | +metadata: |
| 30 | + name: argocd <1> |
| 31 | + namespace: openshift-gitops <2> |
| 32 | +spec: |
| 33 | + ha: |
| 34 | + enabled: true <3> |
| 35 | +---- |
| 36 | +<1> The name of the Argo CD instance. |
| 37 | +<2> The namespace where you want to run the Argo CD instance. |
| 38 | +<3> The flag value that enables the HA feature. If you do not want to enable HA, do not include this line or set the flag value as `false`. |
| 39 | + |
| 40 | +.. Click *Create*. |
| 41 | + |
| 42 | +.. Verify that the Argo CD pods are ready and running: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc get pods -n <namespace> <1> |
| 47 | +---- |
| 48 | +<1> Specify a namespace where the Argo CD instance is running, for example `openshift-gitops`. |
| 49 | ++ |
| 50 | +.Example output with HA disabled |
| 51 | +[source,terminal] |
| 52 | +---- |
| 53 | +NAME READY STATUS RESTARTS AGE |
| 54 | +argocd-application-controller-0 1/1 Running 0 26s |
| 55 | +argocd-redis-84b77d4f58-vp6zm 1/1 Running 0 37s |
| 56 | +argocd-repo-server-5b959b57f4-znxjq 1/1 Running 0 37s |
| 57 | +argocd-server-6b8787d686-wv9zh 1/1 Running 0 37s |
| 58 | +---- |
| 59 | ++ |
| 60 | +[NOTE] |
| 61 | +==== |
| 62 | +The HA-enabled TLS configuration requires a cluster with at least three worker nodes. It can take a few minutes for the output to appear if you have enabled the Argo CD instances with HA configuration. |
| 63 | +==== |
| 64 | ++ |
| 65 | +.Example output with HA enabled |
| 66 | +[source,terminal] |
| 67 | +---- |
| 68 | +NAME READY STATUS RESTARTS AGE |
| 69 | +argocd-application-controller-0 1/1 Running 0 10m |
| 70 | +argocd-redis-ha-haproxy-669757fdb7-5xg8h 1/1 Running 0 10m |
| 71 | +argocd-redis-ha-server-0 2/2 Running 0 9m9s |
| 72 | +argocd-redis-ha-server-1 2/2 Running 0 98s |
| 73 | +argocd-redis-ha-server-2 2/2 Running 0 53s |
| 74 | +argocd-repo-server-576499d46d-8hgbh 1/1 Running 0 10m |
| 75 | +argocd-server-9486f88b7-dk2ks 1/1 Running 0 10m |
| 76 | +---- |
| 77 | + |
| 78 | +. Create a self-signed certificate for the Redis server by using one of the following options depending on your HA configuration: |
| 79 | + |
| 80 | +* For the Argo CD instance with HA disabled, run the following command: |
| 81 | ++ |
| 82 | +[source,terminal] |
| 83 | +---- |
| 84 | +$ openssl req -new -x509 -sha256 \ |
| 85 | + -subj "/C=XX/ST=XX/O=Testing/CN=redis" \ |
| 86 | + -reqexts SAN -extensions SAN \ |
| 87 | + -config <(printf "\n[SAN]\nsubjectAltName=DNS:argocd-redis.<namespace>.svc.cluster.local\n[req]\ndistinguished_name=req") \ <1> |
| 88 | + -keyout /tmp/redis.key \ |
| 89 | + -out /tmp/redis.crt \ |
| 90 | + -newkey rsa:4096 \ |
| 91 | + -nodes \ |
| 92 | + -sha256 \ |
| 93 | + -days 10 |
| 94 | +---- |
| 95 | +<1> Specify a namespace where the Argo CD instance is running, for example `openshift-gitops`. |
| 96 | ++ |
| 97 | +.Example output |
| 98 | +[source,terminal] |
| 99 | +---- |
| 100 | +Generating a RSA private key |
| 101 | +...............++++ |
| 102 | +............................++++ |
| 103 | +writing new private key to '/tmp/redis.key' |
| 104 | +---- |
| 105 | + |
| 106 | +* For the Argo CD instance with HA enabled, run the following command: |
| 107 | ++ |
| 108 | +[source,terminal] |
| 109 | +---- |
| 110 | +$ openssl req -new -x509 -sha256 \ |
| 111 | + -subj "/C=XX/ST=XX/O=Testing/CN=redis" \ |
| 112 | + -reqexts SAN -extensions SAN \ |
| 113 | + -config <(printf "\n[SAN]\nsubjectAltName=DNS:argocd-redis-ha-haproxy.<namespace>.svc.cluster.local\n[req]\ndistinguished_name=req") \ <1> |
| 114 | + -keyout /tmp/redis-ha.key \ |
| 115 | + -out /tmp/redis-ha.crt \ |
| 116 | + -newkey rsa:4096 \ |
| 117 | + -nodes \ |
| 118 | + -sha256 \ |
| 119 | + -days 10 |
| 120 | +---- |
| 121 | +<1> Specify a namespace where the Argo CD instance is running, for example `openshift-gitops`. |
| 122 | ++ |
| 123 | +.Example output |
| 124 | +[source,terminal] |
| 125 | +---- |
| 126 | +Generating a RSA private key |
| 127 | +...............++++ |
| 128 | +............................++++ |
| 129 | +writing new private key to '/tmp/redis-ha.key' |
| 130 | +---- |
| 131 | + |
| 132 | +. Verify that the generated certificate and key are available in the `/tmp` directory by running the following commands: |
| 133 | ++ |
| 134 | +[source,terminal] |
| 135 | +---- |
| 136 | +$ cd /tmp |
| 137 | +---- |
| 138 | ++ |
| 139 | +[source,terminal] |
| 140 | +---- |
| 141 | +$ ls |
| 142 | +---- |
| 143 | ++ |
| 144 | +.Example output with HA disabled |
| 145 | +[source,terminal] |
| 146 | +---- |
| 147 | +... |
| 148 | +redis.crt |
| 149 | +redis.key |
| 150 | +... |
| 151 | +---- |
| 152 | ++ |
| 153 | +.Example output with HA enabled |
| 154 | +[source,terminal] |
| 155 | +---- |
| 156 | +... |
| 157 | +redis-ha.crt |
| 158 | +redis-ha.key |
| 159 | +... |
| 160 | +---- |
| 161 | + |
| 162 | +. Create the `argocd-operator-redis-tls` secret by using one of the following options depending on your HA configuration: |
| 163 | + |
| 164 | +* For the Argo CD instance with HA disabled, run the following command: |
| 165 | ++ |
| 166 | +[source,terminal] |
| 167 | +---- |
| 168 | +$ oc create secret tls argocd-operator-redis-tls --key=/tmp/redis.key --cert=/tmp/redis.crt |
| 169 | +---- |
| 170 | + |
| 171 | +* For the Argo CD instance with HA enabled, run the following command: |
| 172 | ++ |
| 173 | +[source,terminal] |
| 174 | +---- |
| 175 | +$ oc create secret tls argocd-operator-redis-tls --key=/tmp/redis-ha.key --cert=/tmp/redis-ha.crt |
| 176 | +---- |
| 177 | ++ |
| 178 | +.Example output |
| 179 | +[source,terminal] |
| 180 | +---- |
| 181 | +secret/argocd-operator-redis-tls created |
| 182 | +---- |
| 183 | + |
| 184 | +. Annotate the secret to indicate that it belongs to the Argo CD CR: |
| 185 | ++ |
| 186 | +[source,terminal] |
| 187 | +---- |
| 188 | +$ oc annotate secret argocd-operator-redis-tls argocds.argoproj.io/name=<instance-name> <1> |
| 189 | +---- |
| 190 | +<1> Specify a name of the Argo CD instance, for example `argocd`. |
| 191 | ++ |
| 192 | +.Example output |
| 193 | +[source,terminal] |
| 194 | +---- |
| 195 | +secret/argocd-operator-redis-tls annotated |
| 196 | +---- |
| 197 | + |
| 198 | +. Verify that the Argo CD pods are ready and running: |
| 199 | ++ |
| 200 | +[source,terminal] |
| 201 | +---- |
| 202 | +$ oc get pods -n <namespace> <1> |
| 203 | +---- |
| 204 | +<1> Specify a namespace where the Argo CD instance is running, for example `openshift-gitops`. |
| 205 | ++ |
| 206 | +.Example output with HA disabled |
| 207 | +[source,terminal] |
| 208 | +---- |
| 209 | +NAME READY STATUS RESTARTS AGE |
| 210 | +argocd-application-controller-0 1/1 Running 0 26s |
| 211 | +argocd-redis-84b77d4f58-vp6zm 1/1 Running 0 37s |
| 212 | +argocd-repo-server-5b959b57f4-znxjq 1/1 Running 0 37s |
| 213 | +argocd-server-6b8787d686-wv9zh 1/1 Running 0 37s |
| 214 | +---- |
| 215 | ++ |
| 216 | +[NOTE] |
| 217 | +==== |
| 218 | +It can take a few minutes for the output to appear if you have enabled the Argo CD instances with HA configuration. |
| 219 | +==== |
| 220 | ++ |
| 221 | +.Example output with HA enabled |
| 222 | +[source,terminal] |
| 223 | +---- |
| 224 | +NAME READY STATUS RESTARTS AGE |
| 225 | +argocd-application-controller-0 1/1 Running 0 10m |
| 226 | +argocd-redis-ha-haproxy-669757fdb7-5xg8h 1/1 Running 0 10m |
| 227 | +argocd-redis-ha-server-0 2/2 Running 0 9m9s |
| 228 | +argocd-redis-ha-server-1 2/2 Running 0 98s |
| 229 | +argocd-redis-ha-server-2 2/2 Running 0 53s |
| 230 | +argocd-repo-server-576499d46d-8hgbh 1/1 Running 0 10m |
| 231 | +argocd-server-9486f88b7-dk2ks 1/1 Running 0 10m |
| 232 | +---- |
0 commit comments