Compare commits

..

No commits in common. "master" and "7.1.2" have entirely different histories.

16 changed files with 123 additions and 92 deletions

57
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,57 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 90
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 30
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- bug
- pinned
- security
- planned
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
pulls:
markComment: |-
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
unmarkComment: >-
This pull request is no longer marked for closure.
closeComment: >-
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
issues:
markComment: |-
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
unmarkComment: >-
This issue is no longer marked for closure.
closeComment: >-
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

View File

@ -19,12 +19,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out the codebase. - name: Check out the codebase.
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
path: 'geerlingguy.kubernetes' path: 'geerlingguy.kubernetes'
- name: Set up Python 3. - name: Set up Python 3.
uses: actions/setup-python@v5 uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'
@ -41,7 +41,7 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- distro: rockylinux9 - distro: rockylinux8
playbook: converge.yml playbook: converge.yml
- distro: ubuntu2004 - distro: ubuntu2004
playbook: converge.yml playbook: converge.yml
@ -53,17 +53,17 @@ jobs:
steps: steps:
- name: Check out the codebase. - name: Check out the codebase.
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
path: 'geerlingguy.kubernetes' path: 'geerlingguy.kubernetes'
- name: Set up Python 3. - name: Set up Python 3.
uses: actions/setup-python@v5 uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'
- name: Install test dependencies. - name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] docker run: pip3 install ansible molecule[docker] docker
- name: Run Molecule tests. - name: Run Molecule tests.
run: molecule test run: molecule test

View File

@ -22,12 +22,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out the codebase. - name: Check out the codebase.
uses: actions/checkout@v4 uses: actions/checkout@v2
with: with:
path: 'geerlingguy.kubernetes' path: 'geerlingguy.kubernetes'
- name: Set up Python 3. - name: Set up Python 3.
uses: actions/setup-python@v5 uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'

View File

@ -1,34 +0,0 @@
---
name: Close inactive issues
'on':
schedule:
- cron: "55 3 * * 0" # semi-random time
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
with:
days-before-stale: 120
days-before-close: 60
exempt-issue-labels: bug,pinned,security,planned
exempt-pr-labels: bug,pinned,security,planned
stale-issue-label: "stale"
stale-pr-label: "stale"
stale-issue-message: |
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
close-issue-message: |
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
stale-pr-message: |
This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
close-pr-message: |
This pr has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -7,4 +7,5 @@ rules:
level: warning level: warning
ignore: | ignore: |
.github/workflows/stale.yml .github/stale.yml
.travis.yml

View File

@ -1,6 +1,6 @@
# Ansible Role: Kubernetes # Ansible Role: Kubernetes
[![CI](https://github.com/geerlingguy/ansible-role-kubernetes/actions/workflows/ci.yml/badge.svg)](https://github.com/geerlingguy/ansible-role-kubernetes/actions/workflows/ci.yml) [![CI](https://github.com/geerlingguy/ansible-role-kubernetes/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-kubernetes/actions?query=workflow%3ACI)
An Ansible Role that installs [Kubernetes](https://kubernetes.io) on Linux. An Ansible Role that installs [Kubernetes](https://kubernetes.io) on Linux.
@ -27,8 +27,8 @@ kubernetes_packages:
Kubernetes packages to be installed on the server. You can either provide a list of package names, or set `name` and `state` to have more control over whether the package is `present`, `absent`, `latest`, etc. Kubernetes packages to be installed on the server. You can either provide a list of package names, or set `name` and `state` to have more control over whether the package is `present`, `absent`, `latest`, etc.
```yaml ```yaml
kubernetes_version: '1.32' kubernetes_version: '1.25'
kubernetes_version_rhel_package: '1.32' kubernetes_version_rhel_package: '1.25.1'
``` ```
The minor version of Kubernetes to install. The plain `kubernetes_version` is used to pin an apt package version on Debian, and as the Kubernetes version passed into the `kubeadm init` command (see `kubernetes_version_kubeadm`). The `kubernetes_version_rhel_package` variable must be a specific Kubernetes release, and is used to pin the version on Red Hat / CentOS servers. The minor version of Kubernetes to install. The plain `kubernetes_version` is used to pin an apt package version on Debian, and as the Kubernetes version passed into the `kubeadm init` command (see `kubernetes_version_kubeadm`). The `kubernetes_version_rhel_package` variable must be a specific Kubernetes release, and is used to pin the version on Red Hat / CentOS servers.
@ -140,15 +140,19 @@ kubernetes_ignore_preflight_errors: 'all'
Options passed to `kubeadm init` when initializing the Kubernetes control plane. The `kubernetes_apiserver_advertise_address` defaults to `ansible_default_ipv4.address` if it's left empty. Options passed to `kubeadm init` when initializing the Kubernetes control plane. The `kubernetes_apiserver_advertise_address` defaults to `ansible_default_ipv4.address` if it's left empty.
```yaml ```yaml
kubernetes_apt_release_channel: "stable" kubernetes_apt_release_channel: main
kubernetes_apt_repository: "https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/" kubernetes_apt_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_apt_release_channel }}"
kubernetes_apt_ignore_key_error: false
``` ```
Apt repository options for Kubernetes installation. Apt repository options for Kubernetes installation.
```yaml ```yaml
kubernetes_yum_base_url: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/" kubernetes_yum_arch: x86_64
kubernetes_yum_gpg_key: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/repodata/repomd.xml.key" kubernetes_yum_base_url: "https://packages.cloud.google.com/yum/repos/kubernetes-el7-{{ kubernetes_yum_arch }}"
kubernetes_yum_gpg_key:
- https://packages.cloud.google.com/yum/doc/yum-key.gpg
- https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
kubernetes_yum_gpg_check: true kubernetes_yum_gpg_check: true
kubernetes_yum_repo_gpg_check: true kubernetes_yum_repo_gpg_check: true
``` ```

View File

@ -9,8 +9,8 @@ kubernetes_packages:
- name: kubernetes-cni - name: kubernetes-cni
state: present state: present
kubernetes_version: '1.32' kubernetes_version: '1.25'
kubernetes_version_rhel_package: '1.32' kubernetes_version_rhel_package: '1.25.1'
kubernetes_role: control_plane kubernetes_role: control_plane
@ -29,11 +29,6 @@ kubernetes_pod_network:
# cidr: '192.168.0.0/16' # cidr: '192.168.0.0/16'
kubernetes_kubeadm_kubelet_config_file_path: '/etc/kubernetes/kubeadm-kubelet-config.yaml' kubernetes_kubeadm_kubelet_config_file_path: '/etc/kubernetes/kubeadm-kubelet-config.yaml'
kubernetes_config_kubeadm_apiversion: v1beta3
kubenetes_config_kubelet_apiversion: v1beta1
kubernetes_config_kubeproxy_apiversion: v1alpha1
kubernetes_config_kubelet_configuration: kubernetes_config_kubelet_configuration:
cgroupDriver: "systemd" cgroupDriver: "systemd"
@ -56,11 +51,17 @@ kubernetes_apiserver_advertise_address: ''
kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}' kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
kubernetes_ignore_preflight_errors: 'all' kubernetes_ignore_preflight_errors: 'all'
kubernetes_apt_release_channel: "stable" kubernetes_apt_release_channel: main
kubernetes_apt_repository: "https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/" # Note that xenial repo is used for all Debian derivatives at this time.
kubernetes_apt_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_apt_release_channel }}"
kubernetes_apt_ignore_key_error: false
kubernetes_yum_arch: '$basearch'
kubernetes_yum_base_url: "https://packages.cloud.google.com/yum/repos/kubernetes-el7-{{ kubernetes_yum_arch }}"
kubernetes_yum_gpg_key:
- https://packages.cloud.google.com/yum/doc/yum-key.gpg
- https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
kubernetes_yum_base_url: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/"
kubernetes_yum_gpg_key: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/repodata/repomd.xml.key"
kubernetes_yum_gpg_check: true kubernetes_yum_gpg_check: true
kubernetes_yum_repo_gpg_check: true kubernetes_yum_repo_gpg_check: true

View File

@ -9,6 +9,11 @@ galaxy_info:
license: "license (BSD, MIT)" license: "license (BSD, MIT)"
min_ansible_version: 2.10 min_ansible_version: 2.10
platforms: platforms:
- name: EL
versions:
- 7
- 8
- 9
- name: Debian - name: Debian
versions: versions:
- stretch - stretch

View File

@ -1,7 +1,7 @@
--- ---
- name: Converge - name: Converge
hosts: all hosts: all
#become: true become: true
vars: vars:
kubernetes_pod_network: kubernetes_pod_network:

View File

@ -1,7 +1,7 @@
--- ---
- name: Converge - name: Converge
hosts: all hosts: all
#become: true become: true
vars: vars:
# Allow swap in test environments (hard to control in some envs). # Allow swap in test environments (hard to control in some envs).

View File

@ -2,13 +2,11 @@
role_name_check: 1 role_name_check: 1
dependency: dependency:
name: galaxy name: galaxy
options:
ignore-errors: true
driver: driver:
name: docker name: docker
platforms: platforms:
- name: instance - name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux9}-ansible:latest" image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""} command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw - /sys/fs/cgroup:/sys/fs/cgroup:rw

View File

@ -50,27 +50,18 @@
register: flannel_result register: flannel_result
changed_when: "'created' in flannel_result.stdout" changed_when: "'created' in flannel_result.stdout"
when: kubernetes_pod_network.cni == 'flannel' when: kubernetes_pod_network.cni == 'flannel'
until: flannel_result is not failed
retries: 12
delay: 5
- name: Configure Calico networking. - name: Configure Calico networking.
command: "kubectl apply -f {{ kubernetes_calico_manifest_file }}" command: "kubectl apply -f {{ kubernetes_calico_manifest_file }}"
register: calico_result register: calico_result
changed_when: "'created' in calico_result.stdout" changed_when: "'created' in calico_result.stdout"
when: kubernetes_pod_network.cni == 'calico' when: kubernetes_pod_network.cni == 'calico'
until: calico_result is not failed
retries: 12
delay: 5
- name: Get Kubernetes version for Weave installation. - name: Get Kubernetes version for Weave installation.
shell: kubectl version | base64 | tr -d '\n' shell: kubectl version | base64 | tr -d '\n'
changed_when: false changed_when: false
register: kubectl_version register: kubectl_version
when: kubernetes_pod_network.cni == 'weave' when: kubernetes_pod_network.cni == 'weave'
until: kubectl_version is not failed
retries: 12
delay: 5
- name: Configure Weave networking. - name: Configure Weave networking.
command: "{{ item }}" command: "{{ item }}"

View File

@ -4,22 +4,20 @@
name: name:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
- python3-debian
state: present state: present
- name: Add Kubernetes repository. - name: Add Kubernetes apt key.
deb822_repository: apt_key:
name: kubernetes url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
types: deb state: present
uris: "{{ kubernetes_apt_repository }}" register: add_repository_key
suites: / ignore_errors: "{{ kubernetes_apt_ignore_key_error }}"
signed_by: "{{ kubernetes_apt_repository }}/Release.key"
register: kubernetes_repository
- name: Update Apt cache. - name: Add Kubernetes repository.
apt: apt_repository:
repo: "{{ kubernetes_apt_repository }}"
state: present
update_cache: true update_cache: true
when: kubernetes_repository.changed
- name: Add Kubernetes apt preferences file to pin a version. - name: Add Kubernetes apt preferences file to pin a version.
template: template:

View File

@ -11,9 +11,10 @@
- name: Add Kubernetes GPG keys. - name: Add Kubernetes GPG keys.
rpm_key: rpm_key:
key: "{{ kubernetes_yum_gpg_key }}" key: "{{ item }}"
state: present state: present
register: kubernetes_rpm_key register: kubernetes_rpm_key
with_items: "{{ kubernetes_yum_gpg_key }}"
- name: Make cache if Kubernetes GPG key changed. - name: Make cache if Kubernetes GPG key changed.
command: "yum -q makecache -y --disablerepo='*' --enablerepo='kubernetes'" command: "yum -q makecache -y --disablerepo='*' --enablerepo='kubernetes'"

View File

@ -1,20 +1,20 @@
--- ---
apiVersion: kubeadm.k8s.io/{{ kubernetes_config_kubeadm_apiversion }} apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration kind: InitConfiguration
{{ kubernetes_config_init_configuration | to_nice_yaml }} {{ kubernetes_config_init_configuration | to_nice_yaml }}
--- ---
apiVersion: kubeadm.k8s.io/{{ kubernetes_config_kubeadm_apiversion }} apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration kind: ClusterConfiguration
{{ kubernetes_config_cluster_configuration | to_nice_yaml }} {{ kubernetes_config_cluster_configuration | to_nice_yaml }}
{% if kubernetes_config_kubelet_configuration|length > 0 %} {% if kubernetes_config_kubelet_configuration|length > 0 %}
--- ---
apiVersion: kubelet.config.k8s.io/{{ kubenetes_config_kubelet_apiversion }} apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration kind: KubeletConfiguration
{{ kubernetes_config_kubelet_configuration | to_nice_yaml }} {{ kubernetes_config_kubelet_configuration | to_nice_yaml }}
{% endif %} {% endif %}
{% if kubernetes_config_kube_proxy_configuration|length > 0 %} {% if kubernetes_config_kube_proxy_configuration|length > 0 %}
--- ---
apiVersion: kubeproxy.config.k8s.io/{{ kubernetes_config_kubeproxy_apiversion }} apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration kind: KubeProxyConfiguration
{{ kubernetes_config_kube_proxy_configuration | to_nice_yaml }} {{ kubernetes_config_kube_proxy_configuration | to_nice_yaml }}
{% endif %} {% endif %}

View File

@ -1,3 +1,12 @@
--- ---
procps_package: procps-ng procps_package: procps-ng
kubelet_environment_file_path: /etc/sysconfig/kubelet kubelet_environment_file_path: /etc/sysconfig/kubelet
kubernetes_packages:
- name: kubelet-{{ kubernetes_version_rhel_package }}-0
state: present
- name: kubectl-{{ kubernetes_version_rhel_package }}-0
state: present
- name: kubeadm-{{ kubernetes_version_rhel_package }}-0
state: present
- name: kubernetes-cni
state: present