Merge pull request #12282 from hashicorp/admin-fix

docs: updated admin partitions instructions
This commit is contained in:
mrspanishviking 2022-02-08 07:19:50 -07:00 committed by GitHub
commit d4f965e49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 27 deletions

View File

@ -20,6 +20,10 @@ Admin partitions exist a level above namespaces in the identity hierarchy. They
-> **Preexisting resource nodes and namespaces**: Admin partitions were introduced in Consul 1.11. Resource nodes were not namespaced prior to 1.11. After upgrading to Consul 1.11 or later, all resource nodes will be namespaced. -> **Preexisting resource nodes and namespaces**: Admin partitions were introduced in Consul 1.11. Resource nodes were not namespaced prior to 1.11. After upgrading to Consul 1.11 or later, all resource nodes will be namespaced.
Learn resources are available to help you get started with admin partitions.
- [Multi-Tenancy with Administrative Partitions](https://learn.hashicorp.com/tutorials/consul/consul-admin-partitions?in=consul/enterprise)
### Default Admin Partition ### Default Admin Partition
Each Consul cluster will have a default admin partition named `default`. The `default` partition must contain the Consul servers. The `default` admin partition is different from other partitions that may be created because the namespaces and resources in this partition are replicated between datacenters when they are federated. Each Consul cluster will have a default admin partition named `default`. The `default` partition must contain the Consul servers. The `default` admin partition is different from other partitions that may be created because the namespaces and resources in this partition are replicated between datacenters when they are federated.
@ -59,35 +63,36 @@ Your Consul configuration must meet the following requirements to use admin part
### Versions ### Versions
* Consul 1.11.1 and newer - Consul 1.11.1 and newer
### Security Configurations ### Security Configurations
* The agent token used by the client agent must allow `node:write` in the admin partition. - The agent token used by the client agent must allow `node:write` in the admin partition.
* The `write` permission for `proxy-defaults` requires `mesh:write`. See [Admin Partition Rules](/docs/security/acl/acl-rules#admin-partition-rules) for additional information. - The `write` permission for `proxy-defaults` requires `mesh:write`. See [Admin Partition Rules](/docs/security/acl/acl-rules#admin-partition-rules) for additional information.
* The `write` permissions for ingress and terminating gateways require `mesh:write` privileges. - The `write` permissions for ingress and terminating gateways require `mesh:write` privileges.
* Wildcards (`*`) are not supported for the partition field when creating intentions for admin partitions. The partition name must be explicitly specified. - Wildcards (`*`) are not supported for the partition field when creating intentions for admin partitions. The partition name must be explicitly specified.
* With the exception of the `default` admin partition, ACL rules configured for admin partitions are isolated, so policies defined in partitions outside of the `default` partition can only reference their local partition. - With the exception of the `default` admin partition, ACL rules configured for admin partitions are isolated, so policies defined in partitions outside of the `default` partition can only reference their local partition.
### Agent Configurations ### Agent Configurations
* The admin partition name should be specified in client agent configurations: - The admin partition name should be specified in client agent configurations:
```hcl ```hcl
partition = "<NAME>" partition = "<NAME>"
``` ```
* The anti-entropy sync will use the configured admin partition name when registering the node.
- The anti-entropy sync will use the configured admin partition name when registering the node.
### Kubernetes Requirements ### Kubernetes Requirements
One of the primary use cases for admin partitions is for enabling a service mesh across multiple Kubernetes clusters. The following requirements must be met to create admin partitions on Kubernetes: One of the primary use cases for admin partitions is for enabling a service mesh across multiple Kubernetes clusters. The following requirements must be met to create admin partitions on Kubernetes:
* If you are deploying Consul servers on Kubernetes, then ensure that the Consul servers are deployed within the same Kubernetes cluster. Consul servers may be deployed external to Kubernetes and configured using the `externalServers` stanza. - If you are deploying Consul servers on Kubernetes, then ensure that the Consul servers are deployed within the same Kubernetes cluster. Consul servers may be deployed external to Kubernetes and configured using the `externalServers` stanza.
* Consul clients deployed on the same Kubernetes cluster as the Consul Servers must use the `default` partition. If the clients are required to run on a non-default partition, then the clients must be deployed in a separate Kubernetes cluster. - Consul clients deployed on the same Kubernetes cluster as the Consul Servers must use the `default` partition. If the clients are required to run on a non-default partition, then the clients must be deployed in a separate Kubernetes cluster.
* A Consul Enterprise license must be installed on each Kubernetes cluster. - A Consul Enterprise license must be installed on each Kubernetes cluster.
* The helm chart for consul-k8s v0.39.0 or greater. - The helm chart for consul-k8s v0.39.0 or greater.
* Consul 1.11.1-ent or greater. - Consul 1.11.1-ent or greater.
* All Consul clients must be able to communicate with the Consul servers in the `default` partition, and all servers must be able to communicate with the clients. - All Consul clients must be able to communicate with the Consul servers in the `default` partition, and all servers must be able to communicate with the clients.
## Usage ## Usage
@ -113,6 +118,7 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
1. Create a server configuration values file to override the default Consul Helm chart settings: 1. Create a server configuration values file to override the default Consul Helm chart settings:
<CodeTabs heading="server.yaml"> <CodeTabs heading="server.yaml">
<CodeBlockConfig lineNumbers> <CodeBlockConfig lineNumbers>
```yaml ```yaml
@ -120,7 +126,7 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
enableConsulNamespaces: true enableConsulNamespaces: true
tls: tls:
enabled: true enabled: true
image: hashicorp/consul-enterprise:1.11.1-ent image: hashicorp/consul-enterprise:1.11.2-ent
adminPartitions: adminPartitions:
enabled: true enabled: true
acls: acls:
@ -143,6 +149,7 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
enabled: true enabled: true
enableRedirection: true enableRedirection: true
``` ```
</CodeBlockConfig> </CodeBlockConfig>
</CodeTabs> </CodeTabs>
@ -151,7 +158,7 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
1. Install the Consul server(s) using the values file created in the previous step: 1. Install the Consul server(s) using the values file created in the previous step:
```shell-session ```shell-session
$ helm install server hashicorp/consul --values server.yaml $ helm install server hashicorp/consul --values server.yaml --version "0.40.0"
``` ```
1. After the server starts, get the external IP address for partition service so that it can be added to the client configuration. The IP address is used to bootstrap connectivity between servers and clients. <a name="get-external-ip-address"/> 1. After the server starts, get the external IP address for partition service so that it can be added to the client configuration. The IP address is used to bootstrap connectivity between servers and clients. <a name="get-external-ip-address"/>
@ -187,16 +194,19 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
$ kubectl get secret server-consul-partitions-acl-token --context <server-context> --output yaml | kubectl apply --context <client-context> --filename - $ kubectl get secret server-consul-partitions-acl-token --context <server-context> --output yaml | kubectl apply --context <client-context> --filename -
``` ```
1. Create the workload configuration for client nodes in your cluster. Create a configuration for each admin partition. In the following example, the external IP address and the Kubernetes authentication method IP address from the previous steps have been applied: 1. Create the workload configuration for client nodes in your cluster. Create a configuration for each admin partition.
In the following example, the external IP address and the Kubernetes authentication method IP address from the previous steps have been applied. Also, ensure a unique global name is assigned.
<CodeTabs heading="client.yaml"> <CodeTabs heading="client.yaml">
<CodeBlockConfig lineNumbers>
<CodeBlockConfig lineNumbers highlight="2,27,29,33">
```yaml ```yaml
global: global:
name: client
enabled: false enabled: false
enableConsulNamespaces: true enableConsulNamespaces: true
image: hashicorp/consul-enterprise:1.11.1-ent image: hashicorp/consul-enterprise:1.11.2-ent
adminPartitions: adminPartitions:
enabled: true enabled: true
name: clients name: clients
@ -218,13 +228,13 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
secretKey: key secretKey: key
externalServers: externalServers:
enabled: true enabled: true
hosts: [ 34.135.103.67 ] hosts: [34.135.103.67] # See step 5
tlsServerName: server.dc1.consul tlsServerName: server.dc1.consul
k8sAuthMethodHost: https://104.154.156.146 k8sAuthMethodHost: https://104.154.156.146 # See step 6
client: client:
enabled: true enabled: true
exposeGossipPorts: true exposeGossipPorts: true
join: [ 34.135.103.67 ] join: [34.135.103.67] # See step 5
connectInject: connectInject:
enabled: true enabled: true
consulNamespaces: consulNamespaces:
@ -244,9 +254,9 @@ Verify that your Consul deployment meets the [Kubernetes Requirements](#kubernet
1. Install the workload client clusters: 1. Install the workload client clusters:
```shell-session ```shell-session
helm install clients hashicorp/consul --values client.yaml $ helm install clients hashicorp/consul --values client.yaml --version "0.40.0"
``` ```
### Verifying the Deployment ### Verifying the Deployment
@ -255,7 +265,7 @@ You can log into the Consul UI to verify that the partitions appear as expected.
1. If ACLs are enabled, you will need the partitions ACL token, which can be read from the Kubernetes secret. The token is an encoded string that must be decoded in base64, e.g.: 1. If ACLs are enabled, you will need the partitions ACL token, which can be read from the Kubernetes secret. The token is an encoded string that must be decoded in base64, e.g.:
```shell-session ```shell-session
kubectl get secret server-consul-bootstrap-acl-token --template "{{ .data.token | base64decode }}" $ kubectl get secret server-consul-bootstrap-acl-token --template "{{ .data.token | base64decode }}"
``` ```
The example command gets the token using the secret name configured in the values file (`bootstrap.secretName`), decodes the secret, and prints the usable token to the console in JSON format. The example command gets the token using the secret name configured in the values file (`bootstrap.secretName`), decodes the secret, and prints the usable token to the console in JSON format.
@ -269,4 +279,4 @@ You will see the `default` and `clients` partitions available in the **Admin Par
## Known Limitations ## Known Limitations
* Only the `default` admin partition is supported when federating multiple Consul datacenters in a WAN. - Only the `default` admin partition is supported when federating multiple Consul datacenters in a WAN.