mirror of
https://github.com/Noratrieb/vps.git
synced 2026-01-14 16:55:00 +01:00
things that dont work
This commit is contained in:
parent
860aac046a
commit
b5170d4b14
4 changed files with 60 additions and 5 deletions
24
playbooks/kubernetes-init.yml
Normal file
24
playbooks/kubernetes-init.yml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
- name: "Init Cluster"
|
||||||
|
block:
|
||||||
|
- name: Wait for everything to start up
|
||||||
|
# TODO Wait for the coredns pods to be Pending
|
||||||
|
ansible.builtin.command: "false"
|
||||||
|
changed_when: false
|
||||||
|
- name: Apply Flannel
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: kubectl apply -f https://github.com/flannel-io/flannel/releases/download/v0.24.2/kube-flannel.yml
|
||||||
|
changed_when: true
|
||||||
|
- name: Give it some time to breathe
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: sleep 30
|
||||||
|
changed_when: false
|
||||||
|
- name: Allow scheduling on the control plane
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: kubectl taint nodes --all node-role.kubernetes.io/control-plane-
|
||||||
|
changed_when: true
|
||||||
|
- name: Start nginx test containers
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: kubectl apply -f /root/nginx-test.yaml
|
||||||
|
changed_when: true
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /etc/kubernetes/admin.conf
|
||||||
|
|
@ -72,23 +72,29 @@
|
||||||
src: "../vps1/kubeadm-config.yaml"
|
src: "../vps1/kubeadm-config.yaml"
|
||||||
dest: "/root/kubeadm-config.yaml"
|
dest: "/root/kubeadm-config.yaml"
|
||||||
mode: "u=r,g=r,o=r"
|
mode: "u=r,g=r,o=r"
|
||||||
|
- name: Copy test nginx deployment
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "../vps1/nginx-test.yaml"
|
||||||
|
dest: "/root/nginx-test.yaml"
|
||||||
|
mode: "u=rw,g=r,o=r"
|
||||||
|
- name: Exit early
|
||||||
|
ansible.builtin.command: "false"
|
||||||
|
changed_when: false
|
||||||
# ====================
|
# ====================
|
||||||
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm
|
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm
|
||||||
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#initializing-your-control-plane-node
|
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#initializing-your-control-plane-node
|
||||||
- name: Init
|
- name: Init
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
|
# https://github.com/flannel-io/flannel/blob/master/Documentation/kubernetes.md
|
||||||
|
# Delete it with https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#tear-down
|
||||||
cmd: kubeadm init --config /root/kubeadm-config.yaml
|
cmd: kubeadm init --config /root/kubeadm-config.yaml
|
||||||
creates: /var/lib/kubelet/config.yaml
|
creates: /var/lib/kubelet/config.yaml
|
||||||
notify:
|
notify:
|
||||||
- "Installed Cluster"
|
- "Installed Cluster"
|
||||||
# We may need to export KUBECONFIG=/etc/kubernetes/admin.conf ?
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: "Containerd config changed"
|
- name: "Containerd config changed"
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: containerd
|
name: containerd
|
||||||
state: reloaded
|
state: reloaded
|
||||||
- name: "Installed Cluster"
|
- name: "Installed Cluster"
|
||||||
ansible.builtin.command:
|
ansible.builtin.include_tasks: ./kubernetes-init.yml
|
||||||
cmd: kubectl apply -f https://github.com/flannel-io/flannel/releases/v0.24.2/download/kube-flannel.yml
|
|
||||||
environment:
|
|
||||||
KUBECONFIG: /etc/kubernetes/admin.conf
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ kind: ClusterConfiguration
|
||||||
apiVersion: kubeadm.k8s.io/v1beta3
|
apiVersion: kubeadm.k8s.io/v1beta3
|
||||||
kubernetesVersion: v1.29.0
|
kubernetesVersion: v1.29.0
|
||||||
controlPlaneEndpoint: k8s-control.nilstrieb.dev
|
controlPlaneEndpoint: k8s-control.nilstrieb.dev
|
||||||
|
networking:
|
||||||
|
podSubnet: "10.244.0.0/16" # --pod-network-cidr
|
||||||
---
|
---
|
||||||
kind: KubeletConfiguration
|
kind: KubeletConfiguration
|
||||||
apiVersion: kubelet.config.k8s.io/v1beta1
|
apiVersion: kubelet.config.k8s.io/v1beta1
|
||||||
|
|
|
||||||
23
vps1/nginx-test.yaml
Normal file
23
vps1/nginx-test.yaml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: nginx-deployment
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: nginx
|
||||||
|
replicas: 2
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: nginx
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: nginx
|
||||||
|
image: nginx
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
Loading…
Add table
Add a link
Reference in a new issue