This file contains hidden or 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
| $ kubectl get all | |
| NAME READY STATUS RESTARTS AGE | |
| pod/nginx-deployment-d7b95894f-2hpjk 1/1 Running 0 5m47s | |
| pod/nginx-deployment-d7b95894f-49lrh 1/1 Running 0 5m47s | |
| pod/nginx-deployment-d7b95894f-wl497 1/1 Running 0 5m47s | |
| NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE | |
| service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 137m | |
| service/nginx-service-np NodePort 10.103.75.9 <none> 8082:30000/TCP 5m47s | |
| NAME READY UP-TO-DATE AVAILABLE AGE | |
| deployment.apps/nginx-deployment 3/3 3 3 5m47s |
This file contains hidden or 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
| IMAGE_NAME = "bento/ubuntu-20.04" | |
| K8S_NAME = "ditwl-k8s-01" | |
| MASTERS_NUM = 1 | |
| MASTERS_CPU = 2 | |
| MASTERS_MEM = 2048 | |
| NODES_NUM = 2 | |
| NODES_CPU = 2 | |
| NODES_MEM = 2048 |
This file contains hidden or 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
| # Generated by Vagrant | |
| k8s-n-2 ansible_host=127.0.0.1 ansible_port=2201 ansible_user='vagrant' ansible_ssh_private_key_file='/home/jruiz/.vagrant.d/insecure_private_key' | |
| k8s-m-1 ansible_host=127.0.0.1 ansible_port=2222 ansible_user='vagrant' ansible_ssh_private_key_file='/home/jruiz/.vagrant.d/insecure_private_key' | |
| k8s-n-1 ansible_host=127.0.0.1 ansible_port=2200 ansible_user='vagrant' ansible_ssh_private_key_file='/home/jruiz/.vagrant.d/insecure_private_key' |
This file contains hidden or 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
| #https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/ | |
| #https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/ | |
| - name: Configuring the kubelet cgroup driver | |
| template: | |
| src: kubeadm-config.yaml | |
| dest: /home/{{ k8s_master_admin_user }}/kubeadm-config.yaml | |
| #https://docs.projectcalico.org/v3.6/getting-started/kubernetes/ | |
| #kubeadm init --config /home/vagrant/kubeadm-config.yaml | |
| # --cri-socket /run/containerd/containerd.sock |
This file contains hidden or 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
| - name: Copy the join command to {{ k8s_cluster_name }} cluster | |
| copy: | |
| src: "./{{ k8s_cluster_name }}-join-command" | |
| dest: /home/{{ k8s_node_admin_user }}/{{ k8s_cluster_name }}-join-command | |
| owner: "{{ k8s_node_admin_user }}" | |
| group: "{{ k8s_node_admin_group }}" | |
| mode: 0760 | |
| - name: Join the node to cluster {{ k8s_cluster_name }} | |
| command: sh /home/{{ k8s_node_admin_user }}/{{ k8s_cluster_name }}-join-command |
This file contains hidden or 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
| dependencies: | |
| - { role: k8s/common, | |
| k8s_common_admin_user: "{{k8s_node_admin_user}}", | |
| k8s_common_admin_group: "{{k8s_node_admin_group}}" | |
| } |
This file contains hidden or 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
| dependencies: | |
| - { role: add_packages, | |
| linux_add_packages_repositories: "{{ k8s_common_add_packages_repositories }}", | |
| linux_add_packages_keys: "{{ k8s_common_add_packages_keys }}", | |
| linux_add_packages_names: "{{ k8s_common_add_packages_names }}", | |
| linux_remove_packages_names: "{{ k8s_common_remove_packages_names }}" | |
| } |
This file contains hidden or 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
| k8s_common_add_packages_keys: | |
| - key: https://download.docker.com/linux/ubuntu/gpg | |
| - key: https://packages.cloud.google.com/apt/doc/apt-key.gpg | |
| k8s_common_add_packages_repositories: | |
| - repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ansible_distribution_release}} stable" | |
| - repo: "deb https://apt.kubernetes.io/ kubernetes-xenial main" #k8s not available for Bionic (Ubuntu 18.04) | |
| k8s_common_add_packages_names: | |
| - name: apt-transport-https |
This file contains hidden or 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
| - name: Remove current swaps from fstab | |
| lineinfile: | |
| dest: /etc/fstab | |
| regexp: '^/[\S]+\s+none\s+swap ' | |
| state: absent | |
| - name: Disable swap | |
| command: swapoff -a | |
| when: ansible_swaptotal_mb > 0 |
This file contains hidden or 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
| --- | |
| - name: Add new repositories keys | |
| apt_key: | |
| url='{{item.key}}' | |
| with_items: "{{ linux_add_packages_keys | default([])}}" | |
| when: linux_add_packages_keys is defined and not (linux_add_packages_keys is none or linux_add_packages_keys | trim == '') | |
| register: aptnewkeys | |
| - name: Add new repositories to sources | |
| apt_repository: | |
| repo='{{item.repo}}' |