diff --git a/Documents/~$Chuong-trinh-dao-tao-thuc-tap-sinh-smarthome-platform-devops.xlsx b/Documents/~$Chuong-trinh-dao-tao-thuc-tap-sinh-smarthome-platform-devops.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..cb48f4253e732a5274bbb9a52566c44ade0e1613 Binary files /dev/null and b/Documents/~$Chuong-trinh-dao-tao-thuc-tap-sinh-smarthome-platform-devops.xlsx differ diff --git a/Week6/pod.yml b/Week6/pod.yml index 01cac24622eb386da6e282d2dda19239235c8bc0..c8a84190be9a50859813cab62fde339f37328b85 100644 --- a/Week6/pod.yml +++ b/Week6/pod.yml @@ -11,3 +11,10 @@ spec: image: nigelpoulton/k8sbook:1.0 ports: - containerPort: 8080 + resources: + requests: + memory: "128Mi" + cpu: "500m" + limits: + memory: "512Mi" + cpu: "1000m" \ No newline at end of file diff --git a/Week7/README.md b/Week7/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e83b2907e3110a70a3f57b1fca84bac9d3d724bd --- /dev/null +++ b/Week7/README.md @@ -0,0 +1 @@ +### Connect Minikube to NFS server diff --git a/Week7/ansible-playbook/ansible.cfg b/Week7/ansible-playbook/ansible.cfg new file mode 100644 index 0000000000000000000000000000000000000000..9524965855d612fe95b7986a9bbb39599ac85a13 --- /dev/null +++ b/Week7/ansible-playbook/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +inventory=inventory.ini +private_key_file=~/.ssh/ansible diff --git a/Week7/ansible-playbook/inventory.ini b/Week7/ansible-playbook/inventory.ini new file mode 100644 index 0000000000000000000000000000000000000000..7c2ea3b0df9302d5464ae81cf7b8d7ca96ade44d --- /dev/null +++ b/Week7/ansible-playbook/inventory.ini @@ -0,0 +1,5 @@ +[nfs] +192.168.67.9 + +[nfs:vars] +ansible_user=jay \ No newline at end of file diff --git a/Week7/ansible-playbook/nfs-config.j2 b/Week7/ansible-playbook/nfs-config.j2 new file mode 100644 index 0000000000000000000000000000000000000000..445eefc660c470f69d3ec5edac855c68ac0fd886 --- /dev/null +++ b/Week7/ansible-playbook/nfs-config.j2 @@ -0,0 +1,6 @@ + +# To connect NFS server from MacOS +# Set the 'insecure', 'all-squash', 'anonuid' and 'anongid' options in the /etc/exports file +# Use the full 'nfs://[server-IP]/path/nfs_share_dir' path in Finder's Connect to Server + +{{ nfs_share_dir }} {{ subnet_ip }}(rw,all_squash,sync,no_subtree_check,anonuid=65534,anongid=65534,insecure) \ No newline at end of file diff --git a/Week7/ansible-playbook/nfs-setup.yml b/Week7/ansible-playbook/nfs-setup.yml new file mode 100644 index 0000000000000000000000000000000000000000..f2b5bb688b853a0c79658de7c7b8e9c8a2f958fc --- /dev/null +++ b/Week7/ansible-playbook/nfs-setup.yml @@ -0,0 +1,43 @@ +--- +- name: Set up a NFS server in ubuntu + hosts: all + become: true + + vars: + subnet_ip: 192.168.67.0/24 + nfs_share_dir: /var/nfs/k8s + + tasks: + - name: Install nfs-kernel-server + ansible.builtin.apt: + name: nfs-kernel-server + state: present + + - name: Create share dicrectory + ansible.builtin.file: + path: /var/nfs/k8s + state: directory + mode: '0777' + + - name: Change ownership of a directory + ansible.builtin.file: + path: /var/nfs/k8s + state: directory + recurse: true + owner: nobody + group: nogroup + + - name: Config the NFS + ansible.builtin.template: + src: nfs-config.j2 + dest: /etc/exports + owner: root + group: root + mode: '0644' + notify: Restart nfs-kernel-server service + + handlers: + - name: Restart nfs-kernel-server service + ansible.builtin.service: + name: nfs-kernel-server + state: restarted diff --git a/Week7/nfs-pv.yml b/Week7/nfs-pv.yml new file mode 100644 index 0000000000000000000000000000000000000000..f8ce800a88db4d1a973b0283633564441d882589 --- /dev/null +++ b/Week7/nfs-pv.yml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: nfs-pv +spec: + capacity: + storage: 1Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Recycle + storageClassName: slow + mountOptions: + - hard + - nfsvers=4.1 + nfs: + path: /tmp + server: 172.17.0.2 \ No newline at end of file