Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tailscale as Third Party Integration for Palette Edge #1878

Merged
merged 71 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d385bcf
feat: palette 4.2 release
karl-cardenas-coding Nov 7, 2023
8ae38a9
Merge branch 'master' into release-4-2
karl-cardenas-coding Nov 8, 2023
d7d70f0
Merge branch 'master' into release-4-2
karl-cardenas-coding Nov 9, 2023
e77b5bb
Merge branch 'master' into release-4-2
karl-cardenas-coding Nov 9, 2023
77147f0
Merge branch 'master' of github.com:spectrocloud/librarium into relea…
karl-cardenas-coding Nov 14, 2023
df86e61
docs: palette validator (#1783)
karl-cardenas-coding Nov 14, 2023
efcbf0d
Merge branch 'master' into release-4-2
karl-cardenas-coding Nov 15, 2023
a099a75
Merge branch 'master' into release-4-2
karl-cardenas-coding Nov 15, 2023
ca9b163
Merge branch 'release-4-2' of github.com:spectrocloud/librarium into …
karl-cardenas-coding Nov 15, 2023
3f96182
ci: updated release branch PR CI
karl-cardenas-coding Nov 15, 2023
3cf9614
ci: update release PR CI with missing variables.
karl-cardenas-coding Nov 15, 2023
91d101a
docs: validation cli command update
karl-cardenas-coding Nov 15, 2023
28aa992
docs: added maas PEM-3973 (#1816)
karl-cardenas-coding Nov 16, 2023
5bdf3d9
docs: update Platform Settings page PEM-3979 (#1814)
addetz Nov 17, 2023
478d62f
Merge branch 'master' into release-4-2
karl-cardenas-coding Nov 17, 2023
62f7213
docs: hostname validation (#1826)
lennessyy Nov 27, 2023
f0af957
docs: add step to configure nic for edge hosts (#1856)
lennessyy Nov 30, 2023
06f4366
Merge branch 'release-4-2' of github.com:spectrocloud/librarium into …
karl-cardenas-coding Dec 1, 2023
7de8434
docs: rebase with master
karl-cardenas-coding Dec 4, 2023
4bcb3ad
Merge branch 'master' of github.com:spectrocloud/librarium into relea…
karl-cardenas-coding Dec 6, 2023
cd50050
WIP
kreeuwijk Dec 7, 2023
2cf209c
Tailscale documentation
kreeuwijk Dec 7, 2023
85ea27e
Add bind mount for Tailscale
kreeuwijk Dec 7, 2023
4a75a6e
docs: vertex passkeys (#1873)
karl-cardenas-coding Dec 7, 2023
f9a3c60
layout changes
kreeuwijk Dec 7, 2023
b279664
docs: Palette CLI - docs (#1879)
karl-cardenas-coding Dec 7, 2023
0aaefa6
docs: add draft for private registry and refactor cluster update (#1…
lennessyy Dec 7, 2023
56bd2ef
docs: Add ability to expose services with kube-vip as load balancer (…
lennessyy Dec 7, 2023
39e73dc
docs: start refactoring how-to
lennessyy Dec 8, 2023
8810bbe
docs: updated Palette CLI
karl-cardenas-coding Dec 8, 2023
9079802
docs: update kubeconfig behavior PEM-4198 (#1888)
karl-cardenas-coding Dec 11, 2023
39a3c07
Merge branch 'master' into release-4-2
karl-cardenas-coding Dec 13, 2023
05f3d2f
docs: local harbor registry (#1877)
lennessyy Dec 13, 2023
9ea90f4
Refactor Registries (#1889)
karl-cardenas-coding Dec 14, 2023
e25ad7f
Merge branch 'master' into release-4-2
karl-cardenas-coding Dec 14, 2023
9b16221
docs: added Azure regions and updated symbol DOC-958 (#1899)
karl-cardenas-coding Dec 14, 2023
3e3944e
docs: add edge additions to vmo docs (#1890)
lennessyy Dec 14, 2023
0d94a24
docs: add note about tenant level edge cluster (#1900)
lennessyy Dec 15, 2023
42593d2
docs: add note about nic selection (#1895)
lennessyy Dec 15, 2023
52086eb
Merge branch 'master' into release-4-2
karl-cardenas-coding Dec 19, 2023
61dff12
Update deploy-private-registry.md
3pings Dec 21, 2023
0ec03f8
Merge branch 'master' into release-4-2
karl-cardenas-coding Dec 21, 2023
0d192fb
docs: API docs - 4.2 (#1932)
prathabk Dec 21, 2023
2a256c0
docs: miscellaneous updates (edge) (#1936)
lennessyy Dec 21, 2023
26bf164
merge release branch
lennessyy Dec 21, 2023
2d3c879
docs: update cert renewal behavior PCP-2142 (#1891)
karl-cardenas-coding Dec 22, 2023
79c09fd
Merge branch 'master' into release-4-2
karl-cardenas-coding Dec 22, 2023
455c16e
docs: edit tailscale integration document
lennessyy Dec 22, 2023
375901f
Merge branch 'release-4-2' into edge-tailscale
lennessyy Dec 22, 2023
46d8739
docs add link to balena
lennessyy Dec 22, 2023
f520445
clean up tailscale info
lennessyy Dec 22, 2023
db73c6f
adjust install info and yip stage
kreeuwijk Jan 4, 2024
5ef13d3
Merge branch 'edge-tailscale' of https://github.com/spectrocloud/libr…
lennessyy Jan 4, 2024
1c19f75
remove some duplicated content
lennessyy Jan 4, 2024
1a8d4eb
add vscode to gitignore
lennessyy Jan 4, 2024
c674296
vale comments
lennessyy Jan 4, 2024
2d21e3d
Add solution for known bug
kreeuwijk Jan 5, 2024
89579d4
adjust tailscale cidr workaround
kreeuwijk Jan 5, 2024
0390295
fix tailscale cidr workaround
kreeuwijk Jan 5, 2024
a2a6729
adding MagicDNS troubleshooting
kreeuwijk Jan 7, 2024
01da5aa
edit troubleshooting
lennessyy Jan 12, 2024
c90e24b
update config file
lennessyy Jan 12, 2024
d8bdc5a
add untracked files
lennessyy Jan 12, 2024
df2b934
Merge remote-tracking branch 'origin/master' into edge-tailscale
lennessyy Jan 12, 2024
0449a15
add tailscale to vale
lennessyy Jan 12, 2024
dae2e23
remove line highlight
lennessyy Jan 15, 2024
f20a2e1
fix headings
lennessyy Jan 15, 2024
1c5100f
fix indentation
lennessyy Jan 18, 2024
c3f79d1
Apply suggestions from code review
lennessyy Jan 19, 2024
1b48303
resolve conflicts
lennessyy Jan 19, 2024
80553ed
Merge branch 'master' into edge-tailscale
lennessyy Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ build
.env.development.local
.env.test.local
.env.production.local
.vscode

npm-debug.log*
yarn-debug.log*
Expand Down
10 changes: 0 additions & 10 deletions .vscode/settings.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/docs-content/clusters/edge/edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Palette manages the installation and all the Day-2 activities, such as scaling,

To start with Edge, review the [architecture](architecture.md) and the [lifecycle](edge-native-lifecycle.md) resource to gain a high-level understanding of the Edge components and installation process. Next, become familiar with the [EdgeForge workflow](edgeforge-workflow/edgeforge-workflow.md). EdgeForge is the workflow you will use to customize the Edge host installation to match your environment and organizational needs - this includes creating the Edge artifacts for Edge hosts. The last step of the Edge deployment lifecycle is the deployment step. Review the [Deployment](site-deployment/site-deployment.md) guide to understand what it takes to deploy an Edge host.

You can also review [third party integrations](third-party-integrations/third-party-integrations.md) with Edge to solve specific challenges with additional software.


## Resources
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"position": 100
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
---
sidebar_label: "Use Tailscale to Ensure Remote Host Access"
title: "Use Tailscale to Ensure Remote Host Access"
description: Tailscale for Palette Edge."
hide_table_of_contents: false
sidebar_position: 10
tags: ["edge", "integrations", "tailscale"]
---

You can use Tailscale on your Palette Edge hosts to ensure remote access to your Edge hosts that are connected to the internet. Tailscale provides point-to-point, full-mesh VPN networking with high levels of performance and security. With Tailscale installed, you can use always SSH to access your Edge hosts that have internet access, even if your Edge hosts experience problems with Kubernetes.
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

## Limitations

- Tailscale magicDNS is not compatible with network overlay in Edge clusters. If your Edge cluster has [network overlay](../networking/vxlan-overlay.md) enabled, you must disable MagicDNS in Tailscale or ensure you don't use the 100.100.100.100 DNS server that MagicDNS configures.
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisites

- A Tailscale account. Visit [Tailscale official website](https://login.tailscale.com/start) to register a Tailscale account.
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

- A Tailscale authorization key. We recommend you use a reusable, non-ephemeral key that automatically tags the devices with one or more tags. For more information about auth keys, refer to [Tailscale documentation](https://tailscale.com/kb/1085/auth-keys).
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

- A host machine with an AMD64 processor architecture. You will use this host machine to build Edge artifacts using CanvOS.

- At least one Edge device with an AMD64 processor architecture registered with your Palette account.

- Your Edge devices must be able to connect to Tailscale. This usually means the Edge device must have an internet connection.
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

- An external volume that can be flashed with the Edge installer ISO. For example, a USB drive.

- This how-to uses the EdgeForge workflow to build artifacts used to provision Edge hosts. Review [EdgeForge Workflow](../edgeforge-workflow/palette-canvos.md) to become familiar with how to build EdgeForge artifacts.

## Use Tailscale to Remotely Connect to Your Edge Cluster
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

1. Check out the [CanvOS](https://github.com/spectrocloud/CanvOS) GitHub repository. Change to the **CanvOS** directory and choose a version tag.

2. Add the following content to the end of the file `Dockerfile` to include the Tailscale package in the Edge OS build:
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

<Tabs>
<TabItem value="ubuntu" label="Ubuntu">

```dockerfile
RUN curl -fsSL "https://pkgs.tailscale.com/stable/ubuntu/kinetic.noarmor.gpg" | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null && \
curl -fsSL "https://pkgs.tailscale.com/stable/ubuntu/kinetic.tailscale-keyring.list" | sudo tee /etc/apt/sources.list.d/tailscale.list && \
apt update -y && \
apt install -y tailscale && \
apt-get clean && rm -rf /var/lib/apt/lists/*
```

</TabItem>

<TabItem value="redhat" label="RedHat">

```dockerfile
RUN dnf config-manager --add-repo https://pkgs.tailscale.com/stable/rhel/9/tailscale.repo && \
dnf install tailscale && \
dnf clean all
```

</TabItem>

<TabItem value="other" label="Other">

If you use a different OS, adjust the commands in accordance with the Tailscale [documentation](https://tailscale.com/kb/1031/install-linux/).

</TabItem>
</Tabs>

If you already have commands in your `Dockerfile` that install packages, you can either merge these together with the above content, or keep them as separate RUN statements. Note that every RUN statement creates its own image layer and fewer layers are generally better.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[spectrocloud.ableism] Avoid using ableism terms. Use 'issue' instead of 'RUN'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[spectrocloud.ableism] Avoid using ableism terms. Use 'issue' instead of 'RUN'.


3. Review the **.arg.template** file containing the customizable arguments and create an **.arg** file. Below is a command you can use to create an example **.arg** file. For more information, refer to the [Build Edge Artifacts](../edgeforge-workflow/palette-canvos.md) guide.

```bash
cat << EOF > .arg
CUSTOM_TAG=$CUSTOM_TAG
IMAGE_REGISTRY=ttl.sh
OS_DISTRIBUTION=ubuntu
IMAGE_REPO=ubuntu
OS_VERSION=22
K8S_DISTRIBUTION=k3s
ISO_NAME=palette-edge-installer
ARCH=amd64
HTTPS_PROXY=
HTTP_PROXY=
PROXY_CERT_PATH=
UPDATE_KERNEL=false
EOF
```

4. Issue the command below to save your tenant registration token to an environment variable. Replace `[your_token_here]` with your actual registration token.

```bash
export token=[your_token_here]
```

5. Issue the following command to create the **user-data** file. Note that we're adding a bind mount for `/var/lib/tailscale` to ensure the state of Tailscale is persisted across node reboots.
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

```yaml
cat << EOF > user-data
stylus:
site:
paletteEndpoint: api.spectrocloud.com
edgeHostToken: $token
projectName: Default
name: edge-randomid
install:
poweroff: true
bind_mounts:
- /var/lib/tailscale
users:
- name: kairos
passwd: kairos
EOF
```

6. Next, add a `stages` block to the **user-data** file to automatically enable Tailscale and register the Edge device. Replace `$AUTH-KEY` with your authorization key from Tailscale:
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

```yaml {14}
stages:
boot.after:
- name: "Register device with Tailscale"
if: '[ ! -f "/run/cos/recovery_mode" ] && ! grep _current-profile /var/lib/tailscale/tailscaled.state'
commands:
- |
ID=$(cat /sys/class/dmi/id/product_uuid)
if [ -f /oem/tailscale/tailscaled.state ]; then
systemctl stop tailscaled
cp /oem/tailscale/tailscaled.state /var/lib/tailscale/tailscaled.state
systemctl start tailscaled
tailscale up --ssh --hostname="edge-${ID}"
else
tailscale up --authkey=$AUTH-KEY --ssh --hostname="edge-${ID}"
mkdir /oem/tailscale
cp /var/lib/tailscale/tailscaled.state /oem/tailscale/tailscaled.state
fi
- name: "Enable Tailscale"
if: '[ ! -f "/run/cos/recovery_mode" ] && grep _current-profile /var/lib/tailscale/tailscaled.state'
commands:
- |
ID=$(cat /sys/class/dmi/id/product_uuid)
tailscale up --ssh --hostname="edge-${ID}"
```

If you already have a `stages` block in your user-data file, you must merge the existing block together with the above content. The `stages` block is based on Kairos cloud-init stages. For more information on cloud init stages, refer to [Cloud Init Stages](../edge-configuration/cloud-init.md).

:::info

In the above `stages` block, you are using the device ID of your Edge device that is read from the file **/sys/class/dmi/id/product_uuid**, as the hostname with which to register your device with Tailscale. For more information about how this ID is generated, refer to [Install Configurations](../edge-configuration/installer-reference.md#device-id-uid-parameters).

If you want to use a different hostname, especially when using the `deviceUIDPaths` parameter in the **user-data**, you can adjust the two `ID=$(cat /sys/class/dmi/id/product_uuid)` lines in the content above to match your custom device naming configuration.

:::

7. Build the Edge device installation ISO and providers images.

```shell
sudo ./earthly.sh +build-all-images
```

This command may take up to 15-20 minutes to finish depending on the resources of the host machine. Upon completion, the command will display the manifest that you must use in your cluster profile to deploy your cluster.

```shell
===================== Earthly Build SUCCESS =====================
Share your logs with an Earthly account (experimental)! Register for one at https://ci.earthly.dev.
```

8. Afterward, push the provider images to an image registry. For more information, refer to [Build Edge Artifacts](../edgeforge-workflow/palette-canvos.md).

8. Flash your external volume with the Edge installer ISO image. You can use [balena etcher](https://etcher.balena.io/) or any other tool of your choice to flash your volume.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'balena'?


9. Plug the external volume into your Edge device and boot up the device using the volume to prepare your Edge device for installation. For more information, refer to [Prepare Edge Host for Installation](../site-deployment/stage.md).

10. Remove the volume and boot up your device again to register your Edge host. If the Edge host has internet access, it will start up Tailscale and register your device with Tailscale.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Tailscale'?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Tailscale'?



## Validate

1. Log in to [Tailscale console](https://login.tailscale.com/admin/machines).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'Tailscale'?


2. In the **Machines** tab, your Edge device is displayed in the Machines list. You can SSH to your host from any device that is also connected to your Tailscale network. Check out the [Tailscale SSH](https://tailscale.com/kb/1193/tailscale-ssh) documentation page to learn more about SSH with Tailscale.

## Troubleshooting


### All Traffic Dropped for 100.64.0.0/10 CIDR Range

Tailscale uses the 100.64.0.0/10 range of IP addresses for your Tailnets. That means that by default, this address range, or parts of it, cannot be used for any of the following:

- Kubernetes cluster pod CIDR
- Kubernetes cluster service CIDR
- Palette Edge Overlay network CIDR

#### Debug Steps

If you want to use parts of the 100.64.0.0/10 range for your Kubernetes clusters or your Palette Edge Overlay networks, you must limit the IP address range that your Tailnet uses to a fraction of the 100.64.0.0/10 range. Use the following steps to limit your Tailnet range:
lennessyy marked this conversation as resolved.
Show resolved Hide resolved
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

1. First, configure an IP Pool in Tailscale. We have found the following configuration works well to assign addresses in the new range to all nodes:
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

```json
"nodeAttrs": [
{
"target": ["*"],
"ipPool": ["100.74.0.0/16"],
},
],
```

2. Next, in the OS pack of your cluster profile, add the following:

```yaml
stages:
initramfs:
- name: "Tailscale fix systemD unit service"
files:
- path: /etc/systemd/system/tailscale-iptables-fix.service
permissions: 0644
owner: 0
group: 0
content: |
[Unit]
Description=Tailscale iptables fix service
[Service]
ExecStart=/etc/palette/tailscale-iptables.sh
[Install]
WantedBy=multi-user.target
- name: "Tailscale fix systemD unit timer"
files:
- path: /etc/systemd/system/tailscale-iptables-fix.timer
permissions: 0644
owner: 0
group: 0
content: |
[Unit]
Description=Tailscale iptables fix schedule
[Timer]
OnBootSec=15
OnUnitActiveSec=15
[Install]
WantedBy=timers.target
- name: "Tailscale adjustment script"
files:
- path: /etc/palette/tailscale-iptables.sh
permissions: 0755
owner: 0
group: 0
content: |
#!/bin/sh
if iptables -L ts-input | grep DROP | grep 100.64.0.0/10; then
RULEFWD=$(iptables -L ts-forward --line-numbers | grep DROP | grep 100.64.0.0/10 | awk '{print $1}')
RULEINP=$(iptables -L ts-input --line-numbers | grep DROP | grep 100.64.0.0/10 | awk '{print $1}')
iptables -R ts-forward $RULEFWD -s 100.74.0.0/16 -o tailscale0 -j DROP
iptables -R ts-input $RULEINP -s 100.74.0.0/16 -o tailscale0 -j DROP
fi
network:
- name: "Reduce scope of traffic dropped by Tailscale to just the Tailscale ipPool"
commands:
- |
systemctl enable tailscale-iptables-fix.service
systemctl enable tailscale-iptables-fix.timer
systemctl start tailscale-iptables-fix.timer
```

This will ensure Tailscale does not drop traffic for IP ranges that it doesn't own. This is due to a known bug in Tailscale. Even though we restricted the IP Pool, Tailscale still puts in `iptables` rule on every node that drops unknown traffic from any address in the entire 100.64.0.0/10 range.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
sidebar_label: "Third Party Integrations"
title: "Third Party Integrations"
description: "Learn about third party integrations for Palette Edge."
hide_table_of_contents: false
tags: ["edge", "integrations"]
---

Additional third party software can be combined with Palette Edge to solve specific use cases.

The documented integrations are listed below.

* [Use Tailscale to Ensure Remote Host Access](tailscale.md)
lennessyy marked this conversation as resolved.
Show resolved Hide resolved

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vale/styles/Vocab/Internal/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ ethernet
hostname
Entra
README
Tailscale
Tailnet
Sanitization
sanitization
Filepath
Expand Down