-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
# https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ matrix.kube-version }} | ||
cancel-in-progress: true | ||
|
||
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
kube-release: | ||
- 1.23 | ||
|
||
continue-on-error: false | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install conntrack | ||
run: | | ||
sudo apt update | ||
sudo apt install -y conntrack | ||
# Install Kubernetes use apt source with specified version | ||
- name: Install Kubernetes | ||
run: | | ||
sudo snap install kubelet --channel=${{ matrix.kube-release }}/stable --classic | ||
sudo snap install kubectl --channel=${{ matrix.kube-release }}/stable --classic | ||
sudo snap install kubeadm --channel=${{ matrix.kube-release }}/stable --classic | ||
wget -O crictl-linux-amd64.tar.gz https://github.com/kubernetes-sigs/cri-tools/releases/download/v${{ matrix.kube-release }}.0/crictl-v${{ matrix.kube-release }}.0-linux-amd64.tar.gz && \ | ||
sudo tar zxvf crictl-linux-amd64.tar.gz -C /usr/local/bin && \ | ||
rm -f crictl-linux-amd64.tar.gz | ||
- name: Swap off | ||
run: | | ||
sudo swapoff -a | ||
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab | ||
- name: Start Kubelet | ||
run: | | ||
sudo mkdir /etc/systemd/system/kubelet.service.d/ | ||
sudo cp ./test/etc/systemd/system/kubelet.service.d/10-kubeadm.conf /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | ||
sudo sed -i "s#/usr/bin#/snap/bin#" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | ||
sudo cp ./test/etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service | ||
sudo cp ./test/var/lib/kubelet/kubeadm-flags.env /var/lib/kubelet/kubeadm-flags.env | ||
sudo cp ./test/var/lib/kubelet/config.yaml /var/lib/kubelet/config.yaml | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable kubelet --now | ||
sleep 2 | ||
sudo systemctl status kubelet || journalctl -xe -u kubelet || true | ||
- name: Initialize Kubernetes | ||
run: | | ||
sudo kubeadm init || { | ||
journalctl -xeu kubelet | ||
exit 1 | ||
} | ||
- name: Setup kubeconfig | ||
run: | | ||
mkdir -p $HOME/.kube | ||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | ||
sudo chown $(id -u):$(id -g) $HOME/.kube/config | ||
- name: Get pods | ||
run: | | ||
kubectl get pods -o wide --all-namespaces | ||
- name: Get nodes | ||
run: | | ||
kubectl get nodes -o wide |
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,14 @@ | ||
[Unit] | ||
Description=kubelet: The Kubernetes Node Agent | ||
Documentation=https://kubernetes.io/docs/home/ | ||
Wants=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
ExecStart=/usr/bin/kubelet | ||
Restart=always | ||
StartLimitInterval=0 | ||
RestartSec=10 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,11 @@ | ||
# Note: This dropin only works with kubeadm and kubelet v1.11+ | ||
[Service] | ||
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" | ||
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" | ||
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically | ||
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env | ||
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use | ||
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. | ||
EnvironmentFile=-/etc/default/kubelet | ||
ExecStart= | ||
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS |
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,2 @@ | ||
apiVersion: kubelet.config.k8s.io/v1beta1 | ||
kind: KubeletConfiguration |
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 @@ | ||
KUBELET_KUBEADM_ARGS="" |