Skip to content

Commit

Permalink
Add join for remaining control planes
Browse files Browse the repository at this point in the history
Closes #9
  • Loading branch information
edwardtheharris committed Jul 24, 2024
1 parent 5c0f9c0 commit 51976e6
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ package.json
roles/reset/files/*.reset.md
roles/join/files/join.md
roles/init/files/admin.conf
roles/join/files/kcp02*
roles/join/files/kcp03*
20 changes: 15 additions & 5 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
abstract: This is a collection of Ansible playbooks that will create a CA usable
for Kubernetes and etcd clusters.
abstract: >-
This is a set of roles that will initialize a primary control plane,
then join secondary and tertiary control planes to a HA k8s cluster.
authors:
- name: Xander Harris
email: [email protected]
date: 2024-03-08
title: Ansible Bare Metal K8S
title: Ansible Bare Metal HA K8S
---

![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/edwardtheharris/ansible-kcp/ansible.yml?branch=main&style=flat-square&logo=ansible&label=Ansible%20Lint)
Expand All @@ -24,7 +25,7 @@ title: Ansible Bare Metal K8S
### Roles

```{toctree}
:maxdepth: 1
:maxdepth: 3
:caption: roles
roles/index
Expand Down Expand Up @@ -52,8 +53,17 @@ security
- [community.crypto.x509_certificate](https://docs.ansible.com/ansible/latest/collections/community/crypto/x509_certificate_module.html)
- [How to create a small CA](https://docs.ansible.com/ansible/latest/collections/community/crypto/docsite/guide_ownca.html)

## Indices and tables
### Indices and tables

- {ref}`genindex`
- {ref}`modindex`
- {ref}`search`

### Glossary

```{glossary}
HA
High Availability; in this context we mean specifically HA k8s clusters
as described
[here](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/).
```
8 changes: 7 additions & 1 deletion roles/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors:
- name: Xander Harris
email: [email protected]
date: 2024-07-23
title: Bare Metal k8s roles
title: Bare Metal HA k8s roles
---

## Roles
Expand All @@ -20,5 +20,11 @@ join/index
reset/index
```

```{index} roles init
```

```{index} roles; join
```

```{index} roles; reset
```
11 changes: 5 additions & 6 deletions roles/init/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
abstract: >-
This This role initializes a K8s Control Plane suitable for a high
This role initializes a k8s Control Plane suitable for a high
availability cluster.
authors:
- name: Xander Harris
Expand All @@ -9,11 +9,7 @@ date: 2024-07-24
title: K8S HA Control Plane Init
---

Presently only a single Control Plane cluster is supported, but support for
high availability clusters will hopefully be available soon.

[HA Clusters with Kubeadm](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/)
is helped with use of the tool
{term}`HA` Clusters with Kubeadm is helped with use of the tool
[kube-vip](https://kube-vip.io/docs/installation/static/).

More information about the process for HA setup is available
Expand All @@ -24,6 +20,9 @@ A handy tool for switching k8s contexts is called

## Tasks

The role uses {term}`kubeadm` to handle the initialization of the primary
control plane.

```{literalinclude} /roles/init/tasks/main.yml
:language: yaml
```
Expand Down
17 changes: 9 additions & 8 deletions roles/join/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
abstract: This is
authors: Xander Harris
date: 2024-03-01
title: Kubernetes Control Plane
abstract: >-
This role joins additional control planes to a high availability k8s
cluster.
authors:
- name: Xander Harris
email: [email protected]
date: 2024-07-24
title: HA K8S Join Control Planes
---

Presently only a single Control Plane cluster is supported, but support for
high availability clusters will hopefully be available soon.

[HA Clusters with Kubeadm](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/)
is helped with use of the tool
[kube-vip](https://kube-vip.io/docs/installation/static/).
Expand All @@ -20,7 +21,7 @@ A handy tool for switching k8s contexts is called

## Tasks

```{literalinclude} /roles/init/tasks/main.yml
```{literalinclude} /roles/join/tasks/main.yml
:language: yaml
```

Expand Down
12 changes: 12 additions & 0 deletions roles/join/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
src: /root/join_result.md
dest: "roles/join/files/{{ inventory_hostname }}/join_result.md"
flat: true
- name: Copy admin.conf
ansible.builtin.copy:
src: roles/init/files/admin.conf
dest: "{{ item.path }}"
owner: "{{ item.owner }}"
group: kube
mode: u+rw,o-rwx
loop:
- path: /root/.kube/config
owner: root
- path: "/home/{{ join_nonroot }}/.kube/config"
owner: "{{ join_nonroot }}"
7 changes: 7 additions & 0 deletions site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@
- role: join
tags:
- join
- name: Apply required post-init configuration
hosts: kcp01_init
become: true
roles:
- role: kube

Check failure on line 36 in site.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

syntax-check[specific]

the role 'kube' was not found in /home/runner/work/ansible-kcp/ansible-kcp/roles:/home/runner/.cache/ansible-compat/6be488/roles:/home/runner/work/ansible-kcp/ansible-kcp/roles:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/runner/work/ansible-kcp/ansible-kcp
tags:
- kube

0 comments on commit 51976e6

Please sign in to comment.