-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: switch to kube-vip * fix role defaults * convert to kube-vip * fix handler * fix: handle missing apiserver case * add conversion code * remove bindIP fixes
- Loading branch information
Showing
8 changed files
with
189 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `kube_vip` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2023 VEXXHOST, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Image to use for kube-vip | ||
kube_vip_image: ghcr.io/kube-vip/kube-vip:v0.6.4 | ||
|
||
# Interface to use for kube-vip | ||
kube_vip_interface: "{{ keepalived_interface | default(kubernetes_keepalived_interface) }}" | ||
|
||
# IP address to use for kube-vip | ||
kube_vip_address: "{{ keepalived_vip | default(kubernetes_keepalived_vip) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2023 VEXXHOST, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
- name: Restart "kubelet" service | ||
ansible.builtin.service: | ||
name: kubelet | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) 2023 VEXXHOST, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
galaxy_info: | ||
author: VEXXHOST, Inc. | ||
description: kube-vip for kubeadm | ||
license: Apache-2.0 | ||
min_ansible_version: 5.5.0 | ||
standalone: false | ||
platforms: | ||
- name: EL | ||
versions: | ||
- "8" | ||
- "9" | ||
- name: Ubuntu | ||
versions: | ||
- focal | ||
- jammy | ||
|
||
dependencies: | ||
- role: vexxhost.containers.directory | ||
directory_path: /etc/kubernetes/manifests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (c) 2023 VEXXHOST, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
- name: Uninstall legacy HA stack | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: absent | ||
loop: | ||
- /etc/keepalived/keepalived.conf | ||
- /etc/keepalived/check_apiserver.sh | ||
- /etc/kubernetes/manifests/keepalived.yaml | ||
- /etc/haproxy/haproxy.cfg | ||
- /etc/kubernetes/manifests/haproxy.yaml | ||
notify: | ||
- Restart "kubelet" service | ||
|
||
- name: Switch API server to run on port 6443 | ||
ignore_errors: true | ||
ansible.builtin.replace: | ||
path: /etc/kubernetes/manifests/kube-apiserver.yaml | ||
regexp: "16443" | ||
replace: "6443" | ||
register: kube_vip_port_change | ||
failed_when: kube_vip_port_change.rc != 0 and kube_vip_port_change.rc != 257 | ||
notify: | ||
- Restart "kubelet" service | ||
|
||
- name: Upload Kubernetes manifest | ||
ansible.builtin.template: | ||
src: kube-vip.yaml.j2 | ||
dest: /etc/kubernetes/manifests/kube-vip.yaml | ||
owner: root | ||
group: root | ||
mode: "0644" | ||
|
||
- name: Flush handlers | ||
ansible.builtin.meta: flush_handlers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
creationTimestamp: null | ||
name: kube-vip | ||
namespace: kube-system | ||
spec: | ||
containers: | ||
- args: | ||
- manager | ||
env: | ||
- name: vip_arp | ||
value: "true" | ||
- name: port | ||
value: "6443" | ||
- name: vip_interface | ||
value: "{{ kube_vip_interface }}" | ||
- name: vip_cidr | ||
value: "32" | ||
- name: cp_enable | ||
value: "true" | ||
- name: cp_namespace | ||
value: kube-system | ||
- name: vip_ddns | ||
value: "false" | ||
- name: svc_enable | ||
value: "true" | ||
- name: svc_leasename | ||
value: plndr-svcs-lock | ||
- name: vip_leaderelection | ||
value: "true" | ||
- name: vip_leasename | ||
value: plndr-cp-lock | ||
- name: vip_leaseduration | ||
value: "5" | ||
- name: vip_renewdeadline | ||
value: "3" | ||
- name: vip_retryperiod | ||
value: "1" | ||
- name: address | ||
value: "{{ kube_vip_address }}" | ||
- name: prometheus_server | ||
value: :2112 | ||
image: "{{ kube_vip_image | vexxhost.kubernetes.docker_image('ref') }}" | ||
imagePullPolicy: Always | ||
name: kube-vip | ||
resources: {} | ||
securityContext: | ||
capabilities: | ||
add: | ||
- NET_ADMIN | ||
- NET_RAW | ||
volumeMounts: | ||
- mountPath: /etc/kubernetes/admin.conf | ||
name: kubeconfig | ||
hostAliases: | ||
- hostnames: | ||
- kubernetes | ||
ip: 127.0.0.1 | ||
hostNetwork: true | ||
volumes: | ||
- hostPath: | ||
path: /etc/kubernetes/admin.conf | ||
name: kubeconfig | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters