<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Fatma Ecem Ozer on Medium]]></title>
        <description><![CDATA[Stories by Fatma Ecem Ozer on Medium]]></description>
        <link>https://medium.com/@fatmaecemozer?source=rss-e6758e382b6c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3mob3vCy0_gOAZyK</url>
            <title>Stories by Fatma Ecem Ozer on Medium</title>
            <link>https://medium.com/@fatmaecemozer?source=rss-e6758e382b6c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 03:52:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fatmaecemozer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[GlusterFS Basics, Installation and Usage]]></title>
            <link>https://medium.com/@fatmaecemozer/glusterfs-basics-installation-and-usage-7c36392b1df1?source=rss-e6758e382b6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c36392b1df1</guid>
            <dc:creator><![CDATA[Fatma Ecem Ozer]]></dc:creator>
            <pubDate>Mon, 02 May 2022 07:44:08 GMT</pubDate>
            <atom:updated>2022-05-02T07:44:08.047Z</atom:updated>
            <content:encoded><![CDATA[<p>GlusterFS is a network storage solution, an open source, scalable NAS file system.</p><p><em>glusterd:</em> The Gluster daemon/service that manages volumes and cluster membership. It is required to run on all the servers in the trusted storage pool.</p><p><em>brick:</em> Volume directory created in the storage nodes, shared with clients.</p><p><em>volume:</em> Logical volume created outside of bricks, even if the gluster node goes down, data will be stored here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*3XEtBlIhD22ppJOJ.png" /></figure><p>Gluster Volume Types;</p><ul><li>Distributed: the default glusterfs volume, files are distributed across bricks in the volume.</li><li>Replicated: exact copies of the data are maintained on all bricks, number of replicas in the volume can be decided by client while creating the volume.</li><li>Distributed Replicated: files are distributed across replicated sets of bricks.</li><li>Striped: the data is stored in the bricks after dividing it into different stripes.</li><li>Distributed Striped: stripes can be distributed across more than one brick.</li></ul><h3>GlusterFS Installation on Centos7</h3><p><strong>Server side installation:</strong><br>glusterfs-server package is not provided by the official repository, so firstly that package must be available;<br>yum install -y centos-release-gluster</p><p>it would have created a new repository file under;<br>vi /etc/yum.repos.d/CentOS-Gluster-9.repo here it should be checked that the centos-gluster9-test version value is enabled=0 and standard release is enabled=1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/0*D_KkRQa2qunE0beb.png" /></figure><p>yum install -y glusterfs-server</p><p>After installation completed, glusterd service enabled, started and checked for it’s status;<br>systemctl enable glusterd<br>systemctl start glusterd<br>systemctl status glusterd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*VmMf77vE5NYAcYHu.png" /></figure><p>Steps shown above will be configured on both of the two servers defined as gluster1 and gluster2.</p><p>Two gluster storage nodes configured are independent, but the processes on each node has to know about each other, this can be solved by grouping them.<br>IPAddress of gluster1 and gluster2 must be added on the /etc/hosts file, and checked by pinging each others hostname.</p><pre>vi /etc/hosts<br>[ipaddress] [hostname]</pre><p>192.168.1.75 gfs1 192.168.1.76 gfs2 in this case will be added on both servers /etc/hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*vA6eJr6Q3u1l_AkU.png" /></figure><p>ping [hostname]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/0*zTXB0Lwvl2kZy4r9.png" /></figure><p>Two glusters must identify each other;</p><p>from gfs1:<br>gluster peer probe gfs2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/0*jFTd_QqfiQZXcqf_.png" /></figure><p>inorder to fix this issue:<br>sudo systemctl stop firewalld</p><p>after peer probe command applied again:<br>gluster peer status</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/0*jjwO2Nb8m48TiS-E.png" /></figure><p>this command shows the peer’s hostname, status and number of peers.</p><p>Brick can be created directly and used when creating a volume or a volume can be created directly which will also be creating a brick.</p><p><strong>Client side installation:</strong></p><p>yum install -y centos-release-gluster</p><p>After installation under vi /etc/yum.repos.d/CentOS-Gluster-9.repo checked as before.</p><p>yum install -y glusterfs-client</p><h3>Creating Replicated Volumes:</h3><p>A directory created on the both storage servers to have bricks under:<br>mkdir /gluster</p><p>! Since these operations running under root partition, this command will only be available by forcing. <strong>Proper way </strong>is to add a second disk, create a partition and mkdir /gluster on the second partition. !</p><p>Since there’s two storage nodes, 2 replicas specified, a brick called brick1 will be created under both:</p><pre>gluster volume create volume1 replica 2 gfs1:/gluster/brick1 gfs2:/gluster/brick1 force</pre><p>this command can be run on any of the storages.</p><p>gluster volume list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*_toYnsZK7KL9Bdx0.png" /></figure><p>gluster volume info</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/0*TaPXmvhbbaAgdkXx.png" /></figure><p>gluster volume start volume1<br>gluster volume status</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*2CZWPLLCRkAJJ8z8.png" /></figure><p>This volume should be accessible from the client server by mounting:</p><p>mkdir /mnt/volume1 a directory called volume1 created on the client side under /mnt.</p><p>mount -t glusterfs gfs1:volume1 /mnt/volume1 any of the two storage names can be used here.</p><p>! On the client side /etc/hosts checked and necessary ip addresses and hostnames added !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*Njss9xSJ4XOKkQS5.png" /></figure><p><strong>Checksum:</strong></p><p>file1 created under /mnt/volume1 on the client side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/0*CnSFBMRUb0RCZQ7D.png" /></figure><p>and it can be seen under both servers /gluster/brick1 directories:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/0*M_QLwxoR3U6MNFiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/0*yeiNbtfik6Er25uS.png" /></figure><p>Any issue may occur with the mount command can be shown under the logs:<br>sudo vi /var/log/glusterfs/mnt-volume1.log</p><p>To stop and delete a volume and brick:<br>gluster volume stop volume1</p><p>gluster volume delete volume1</p><p>sudo rm -rf /gluster/brick1</p><p>To unmount a volume on the client:<br>umount /mnt/volume1</p><p>To synchronize volumes:<br>gluster volume sync gfs2 volume1</p><p>To detach a peer from the storage pool:<br>gluster peer detach gfs2</p><h3>Creating Distributed Volumes:</h3><p>Distributed volume is the default volume type of glusterfs.<br>gluster volume create volume2 gfs1:/gluster/brick2 gfs2:/gluster/brick2 force</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*Ob1NrnzG991HUUkD.png" /></figure><p>gluster volume start volume2</p><p>gluster volume status</p><p>on the client side:<br>mkdir /mnt/volume2</p><p>mount -t glusterfs gfs1:volume2 /mnt/volume2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*9TXaeq90rXRF1Rh9.png" /></figure><p><strong>Checksum:</strong></p><p>file1 created under /mnt/volume2 on the client side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*ZT0XQmxgPLka03yt.png" /></figure><p>and it can be seen under only one of the servers /gluster/brick2 directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*7LbQSEQXV6XnwLjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/0*_98q-XoVyqm50Jv_.png" /></figure><h3>Using SSL with Glusterfs</h3><p>cd /etc/ssl/<br>sudo openssl genrsa -out glusterfs.key 2048</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/0*MkkVpTJhQz2hvzrr.png" /></figure><p>sudo openssl req -new -x509 -key glusterfs.key -subj &quot;/CN=gfs1&quot; -out glusterfs.pem</p><p>In order to generate a private key and a signed certificate for each servers, steps above must be completed on both and also on the client side.</p><p>From gfs1:<br>mkdir /tmp/ca/<br>cd /tmp/ca/<br>scp root@gfs2:/etc/ssl/glusterfs.pem gfs2.pem</p><p>Client side host informations must be added under /etc/hosts to be able to secure copy!<br>scp root@gfsc:/etc/ssl/glusterfs.pem gfsc.pem</p><p>To concatenate the collected files into a single file called <a href="http://glusterfs.ca/">glusterfs.ca</a>:<br>cat /etc/ssl/glusterfs.pem gfs2.pem gfsc.pem &gt; glusterfs.ca</p><p>cat /etc/ssl/glusterfs.pem gfs2.pem &gt; glusterfs-client.ca</p><p>To be able to achieve file permission chown command may be necessary here for some cases.</p><p>sudo cp glusterfs.ca /etc/ssl/</p><p>scp glusterfs.ca root@gfs2:/etc/ssl/</p><p>scp glusterfs-client.ca root@gfsc:/etc/ssl/glusterfs.ca</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/0*1DMt8VQjFAuDY3aa.png" /></figure><p>/tmp/ca can be removed after:<br>rm -rf /tmp/ca/</p><p>Type the following command on each server node:<br>sudo touch /var/lib/glusterd/secure-access</p><p>Restart the glusterd on all servers:<br>systemctl restart glusterd.service</p><ul><li><em>I would like to thank Just me and Opensource channel, I followed his tutorials, applied on my CentOS vms and took notes; </em><a href="https://www.youtube.com/watch?v=uNloFFSlNjU&amp;list=PL34sAs7_26wOwCvth-EjdgGsHpTwbulWq&amp;index=6">https://www.youtube.com/watch?v=uNloFFSlNjU&amp;list=PL34sAs7_26wOwCvth-EjdgGsHpTwbulWq&amp;index=6</a></li><li>For network encryption setup in GlusterFS check here; <a href="https://www.cyberciti.biz/faq/how-to-enable-tlsssl-encryption-with-glusterfs-storage-cluster-on-linux/">https://www.cyberciti.biz/faq/how-to-enable-tlsssl-encryption-with-glusterfs-storage-cluster-on-linux/</a></li><li><em>Connect me from: </em><a href="https://www.linkedin.com/in/fatma-ecem-ozer/"><em>https://www.linkedin.com/in/fatma-ecem-ozer/</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c36392b1df1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Storage Solutions Basics]]></title>
            <link>https://medium.com/@fatmaecemozer/storage-solutions-basics-c4679974e66c?source=rss-e6758e382b6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4679974e66c</guid>
            <dc:creator><![CDATA[Fatma Ecem Ozer]]></dc:creator>
            <pubDate>Mon, 02 May 2022 07:40:30 GMT</pubDate>
            <atom:updated>2022-05-02T07:40:30.377Z</atom:updated>
            <content:encoded><![CDATA[<h3>RAID (Redundant Array of Independent Disks)</h3><p>Grouping multiple pyhsical disks on an array which appears as a single logical drive using specialized hardware or software called RAID controller.</p><p>RAID enables the disks work together for greater speed and reliability depending on the chosen RAID level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*EZoMtK_AKFWa1TTs.png" /></figure><p><strong>RAID 0 (Striping)</strong><br>Splits data into two or more disks, providing high performance but not fault-tolerance which can cause data loss.</p><p><strong>RAID 1 (Mirroring)</strong><br>Exact copy of the data places on each disk which offers reliability and fault-tolerance in the event of failure.</p><p><strong>RAID 5 (Striping with Parity)</strong><br>Stores parity information for the data -parity is used to re-create the data, not a complete duplicate but contains enough information for recreation- since it stores parity inside, it reduces storage to be used.</p><p><strong>RAID 1+0 -&gt; RAID 10 (Striped Pair of Mirrored Disks)</strong><br>Can be applied using minimum of four disks, it’s a combination of speed and data security but only 50% of capacity can be used.</p><p><strong>SHR (Synology Hybrid RAID) / BeyondRAID</strong><br>Automated RAID management system. Every RAID solution before SHR uses disks which has the same brand, capacity and speed, and when they’re not identical RAID will take the disk with the lowest capacity or speed and limits the rest of the disks with it.<br>SHR ables to combine disks which differs by brand, capacity etc. and provides best outcome.</p><p><strong>To be able to have a RAID setup either a Direct Attached Storage or a Network Attached Storage with more than one disk is needed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/0*O2Npx3NscOZKl4Is.png" /></figure><h3>DAS (Direct Attached Storage)</h3><p>DAS is a simple, economic, versatile data storage solution which the storage is connected directly to the computers or servers through SCSI or other connections. Not designed for sharing data across the network, not suitable for scaling. HDD, SSD, OpticalDD, ExternalDD</p><h3>NAS (Network Attached Storage)</h3><p>File-level centralized storage which provides both local and secure remote data access, scalability and reliablity.<br>NAS can be scaled according to your own storage capacity.<br>These devices are accessible over a network using an ethernet connection and file protocols like NFS (Network File System) or CIFS (Common Internet File System) and SMB (Server Message Block).</p><h3>SAN (Storage Area Network)</h3><p>Block-level, reliable, high performance storage systems which accesses to large blocks of data. Usually uses Fiber Channel — fast data transfer protocol. (ISCSI* and FCoE are alternatives of FiberChannel)</p><ul><li>These are notes from tutorials I follow. <em>Connect me from: </em><a href="https://www.linkedin.com/in/fatma-ecem-ozer/"><em>https://www.linkedin.com/in/fatma-ecem-ozer/</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4679974e66c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Basics, Core Components & Yaml Files]]></title>
            <link>https://medium.com/@fatmaecemozer/kubernetes-basics-core-components-yaml-files-2a11841eb72a?source=rss-e6758e382b6c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a11841eb72a</guid>
            <dc:creator><![CDATA[Fatma Ecem Ozer]]></dc:creator>
            <pubDate>Sat, 09 Apr 2022 14:41:35 GMT</pubDate>
            <atom:updated>2022-04-09T14:41:35.068Z</atom:updated>
            <content:encoded><![CDATA[<p>Kubernetes, an open source orchestration tool developed by Google, manages containerized applications in different deployment environments. <br>- High Availability - Scalability - Disaster Recovery</p><p><em>Pod:</em> smallest part of K8s abstraction over container.</p><ul><li>Usually one application per Pod.</li><li>Each pod has its own IP Address, new IP Address on re-creation.</li></ul><p><em>Service:</em> static IP Address that can be attached to each pod, so even if the pod dies the service and the IP address survives. <br>Everything should be replicated and the replica is connected to the same Service, so Service also works as a LoadBalancer catches the request and forwards it to the least busy pod.</p><p><em>Deployment:</em> blueprint for application pods which also helps other configurations.<br>Database can’t be replicated via Deployment.</p><p><em>StatefulSet:</em> for stateFUL applications, makes sure all Database replicas, reads and writes are synchronized to avoid data inconsistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*bo4Cdlxms-ACRe4AiV60Gw.png" /></figure><p><strong>Instead of deploying StatefulSet, Database are often hosted outside of K8s cluster!</strong></p><p><em>Ingress: </em>used to be able to talk with the application from a browser with a secure protocol and a domain name. Instead of Service, request goes first to Ingress and Ingress forwards it to the Service.</p><p><em>Config Map:</em> external configuration data for the application.</p><p><em>Secret:</em> used to store credentials, base64 encoded format.</p><p><em>Volumes:</em> attaches physical storage either on the local machine or on the remote storage. K8s doesn’t manage data persistance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*KTKjt-zbhktnKauTafpr_Q.png" /></figure><p><strong>K8s Cluster Processes:</strong><br>Worker node components;<br>- Container Runtime, docker etc.<br>- Kubelet, interacts with both the container and node, runs or starts a pod and assign resources<br>- KubeProxy, works as network proxy</p><p>Master node components;<br>- Api-Server, cluster gateway, authentication, authorization<br>- etcd, holds cluster current state, key value storage<br>- Schedular, for assigning pods to nodes<br>- Controller-Manager, cluster state tracking with the help of api-server, <br>Desired State &lt;-&gt; Current State comparison</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*zaPFAOi2sl3m5siK1awoIw.png" /></figure><p>Use configuration file for CRUD;</p><pre>kubectl create deployment NAME — image=image<br>kubectl apply -f [file name] #apply a configuration file <br>kubectl delete -f [file name] #delete with configuration file</pre><p>Debugging Pods;</p><pre>kubectl log [pod name] #log to console<br>kubectl exec -it [pod name] — bin/bash #get interactive terminal<br>kubectl describe pod [pod name] #get info about pod</pre><p>Each configuration file has 3 main parts;<br>- metadata: meta info <br>- specification: attributes are specific for the kind<br>- status: automatically generated and added by kubernetes, comes from etcd</p><p>YAML <em>Yet Another Markup Language</em> Configuration Files;<br>- strict indentation syntax!<br>- store the config file with the code or own git repository</p><p>nginx deployment.yaml file example;</p><pre>apiVersion: apps/v1 <br>kind: Deployment<br>metadata:<br>  name: nginx-deployment<br>  labels: <br>    app: nginx<br>spec:<br>  selector:<br>    matchLabels:<br>      app: nginx<br>  replicas: 1 #tells deployment to run 1 pods matching the template<br>  template:<br>    metadata:<br>      labels:<br>        app: nginx<br>    spec:<br>      containers:<br>      - name: nginx<br>        image: nginx:1.14.2<br>        ports:<br>        - containerPort: 8080</pre><p>nginx service.yaml file example;</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: nginx-service<br>spec:<br>  selector:<br>    app: nginx<br>  ports:<br>  - protocol: TCP<br>    port: 80<br>    targetPort: 8080</pre><p><strong>Mongo Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*QOjbgnhscIOkAqOvERxDjw.png" /></figure><p>MongoDB deployment;<br>mongo.yaml</p><pre>apiVersion: apps/v1 <br>kind: Deployment<br>metadata:<br>  name: mongodb-deployment<br>  labels: <br>    app: mongodb<br>spec:<br>  selector:<br>    matchLabels:<br>      app: mongodb<br>  replicas: 2 #tells deployment to run 2 pods matching the template<br>  template:<br>    metadata:<br>      labels:<br>        app: mongodb<br>    spec:<br>      containers:<br>      - name: mongodb<br>        image: mongo<br>        ports:<br>        - containerPort: 27017<br>        env:<br>        - name: MONGO_INITDB_ROOT_USERNAME<br>          valueFrom: #username and password should be stored in Secret <br>            secretKeyRef:<br>              name: mongodb-secret<br>              key: mongo-root-username<br>        - name: MONGO_INITDB_ROOT_PASSWORD<br>          valueFrom: <br>            secretKeyRef:<br>              name: mongodb-secret<br>              key: mongo-root-password <br>---<br>apiVersion: apps/v1 <br>kind: Service<br>metadata:<br>  name: mongodb-service<br>spec:<br>  selector: #to connect to pod through label<br>    app: mongodb <br>  ports:<br>    - protocol: TCP<br>      port: 27017 #service port <br>      targetPort: 27017 #container port of deployment can be different from service port</pre><p><strong>Secret lives in K8s, not in the repository!</strong><br>mongo-secret.yaml</p><pre>apiVersion: v1 <br>kind: Secret<br>metadata:<br>  name: mongodb-secret<br>type: Opaque #default<br>data: #actual content for key-value pairs must be base64 encoded<br>    mongo-root-username: ###<br>    mongo-root-password: ###</pre><p>base64 encoded username and password can be obtained from terminal;</p><pre>echo -n ‘username’ | base64<br>echo -n ‘password’ | base64</pre><p>Secret file must be applied first;</p><pre>kubectl apply -f mongo-secret.yaml<br>kubectl get secret</pre><p>Deployment &amp; Service file must be applied;</p><pre>kubectl apply -f mongo.yaml<br>kubectl get deployment<br>kubectl get service<br>kubectl describe service [service name]<br>kubectl get pod -o wide<br>kubectl get all | grep mongodb</pre><p>Mongo Express;<br>mongo-express.yaml</p><pre>apiVersion: apps/v1 <br>kind: Deployment<br>metadata:<br>  name: mongo-express<br>  labels: <br>    app: mongo-express<br>spec:<br>  selector:<br>    matchLabels:<br>      app: mongo-express<br>  replicas: 2 #tells deployment to run 2 pods matching the template<br>  template:<br>    metadata:<br>      labels:<br>        app: mongo-express<br>    spec:<br>      containers:<br>      - name: mongo-express<br>        image: mongo-express<br>        ports:<br>        - containerPort: 8081<br>        env:<br>        - name: ME_CONFIG_MONGODB_ADMINUSERNAME<br>          valueFrom: #username and password should be stored in Secret <br>            secretKeyRef:<br>              name: mongodb-secret<br>              key: mongo-root-username<br>        - name: ME_CONFIG_MONGODB_ADMINPASSWORD<br>          valueFrom: <br>            secretKeyRef:<br>              name: mongodb-secret<br>              key: mongo-root-password <br>        - name: ME_CONFIG_MONGODB_SERVER #will be using config map <br>          valueFrom: <br>            configMapKeyRef:<br>              name: mongodb-configmap<br>              key: database_url<br>---<br>apiVersion: apps/v1 <br>kind: Service<br>metadata:<br>  name: mongo-express-service<br>spec:<br>  selector: <br>    app: mongo-express<br>  type: LoadBalancer #except external requests <br>  #LoadBalancer assigns in addition an External IP<br>  ports:<br>    - protocol: TCP<br>      port: 8081 <br>      targetPort: 8081<br>      nodePort: 30000 #between 30000-32767</pre><p>mongo-configmap.yaml</p><pre>apiVersion: v1 <br>kind: ConfigMap<br>metadata:<br>  name: mongodb-configmap<br>data: <br>  database_url: mongodb-service</pre><p>ConfigMap file must be applied first;</p><pre>kubectl apply -f mongo-configmap.yaml<br>kubectl get configmap</pre><p>Deployment &amp; Service file must be applied;</p><pre>kubectl apply -f mongo-express.yaml<br>kubectl get deployment<br>kubectl get service</pre><p>External IP will be accesible through external requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*LHoaGJxIq7sQh0IzGHqKsA.png" /></figure><p><strong>Namespaces</strong>: virtual cluster inside a cluster<br>- group resources<br>- avoid conflicts<br>- re-use components, resource sharing<br>- limit resources and access</p><ul><li>kube-system #do not create or modify in here!<br>kube-public #publicly accessible data<br>kube-node-lease #holds info of nodes, heartbeats<br>default</li></ul><pre>kubectl create namespace NAME</pre><pre>apiVersion: v1 <br>kind: ConfigMap<br>metadata:<br>  name: mongodb-configmap<br>  namespace: newnsname #defining a namespace in config file<br>data: <br>  database_url: mongodb-service</pre><p>Can change the active namespace with kubens!</p><p><strong>Kubernetes Ingress:</strong><br>IP address and port number is not open to see from outside world with use of ingress.</p><p><a href="http://my-app.com*/"><em>http://my-app.com</em></a></p><pre>apiVersion: networking.k8s.io/v1beta1 <br>kind: Ingress<br>metadata:<br>  name: myapp-ingress<br>spec:<br>  rules:<br>  - host: myapp.com #user will enter in browser, valid domain address<br>    http:<br>      paths: #url path<br>      - backend:<br>          serviceName: myapp-internal-service<br>          servicePort: 8080</pre><ul><li>Map domain name to Node’s IP Adress, which is the entrypoint !</li></ul><p>Ingres and Internal Service Configuration:</p><pre>apiVersion: v1 <br>kind: Service<br>metadata:<br>  name: myapp-internal-service<br>spec:<br>  selector:<br>    app: myapp<br>  ports:<br>  - protocol: TCP<br>    port: 80<br>    targetPort: 8080</pre><ul><li>No nodePort needed in internal service!</li></ul><p><strong><em>K8s Nginx Ingress Controller: </em></strong>an implementation that evaluates and processes Ingress rules. Entrypoint to cluster that manages redirections.</p><p>External request that coming from the browser first will hit the LoadBalancer, and it will redirect it to Ingress Controller Pod as the best practise implementation !</p><p>Install Ingress Controller in Minikube:</p><pre>minikube addons enable ingress</pre><p>In Minikube cluster kubernetes-dashboard already exists out-of-the-box.</p><pre>kubectl get namespaces</pre><p>*kubernetes-dashboard* #not accessible externally at the moment</p><pre>kubectl get all -n kubernetes-dashboard</pre><p>dashboard-ingress.yaml</p><pre>apiVersion: networking.k8s.io/v1beta1<br>kind: Ingress<br>metadata:<br>  name: dashboard-ingress<br>  namespace: kubernetes-dashboard<br>spec:<br>  rules:<br>  - host: dashboard.com <br>    http:<br>      paths: <br>      - backend:<br>          serviceName: kubernetes-dashboard<br>          servicePort: 80</pre><pre>kubectl apply -f dashboard-ingress.yaml<br>kubectl get ingress -n kubernetes-dashboard</pre><pre>vi /etc/hosts<br>[IP Address] dashboard.com #Will be exposed to outside world.</pre><p>Multiple paths for the same host:</p><pre>apiVersion: networking.k8s.io/v1beta1<br>kind: Ingress<br>metadata:<br>  name: simple-example<br>spec:<br>  rules:<br>  - host: my-app.com <br>    http:<br>      paths: <br>      - path: /analytics <br>        backend:<br>          serviceName: analytics-service<br>          servicePort: 3000<br>      - path: /shopping<br>        backend: <br>          serviceName: shopping-service<br>          servicePort: 8080</pre><p>Multiple hosts represents a sub-domains:</p><pre>apiVersion: networking.k8s.io/v1beta1<br>kind: Ingress<br>metadata:<br>  name: simple-example<br>spec:<br>  rules:<br>  - host: analytics.myapp.com <br>    http:<br>      paths:  <br>        backend:<br>          serviceName: analytics-service<br>          servicePort: 3000<br>  - host: shopping.myapp.com <br>    http:<br>      paths: <br>        backend:<br>          serviceName: shopping-service<br>          servicePort: 8080</pre><p>Configuring TLS Certificate:</p><pre>apiVersion: networking.k8s.io/v1beta1<br>kind: Ingress<br>metadata:<br>  name: tls-example-ingress<br>spec:<br>  tls: <br>  - host: <br>    - myapp.com <br>    secretName: myapp-secret-tls #reference of a secret that created in the cluster that holds tls certificate<br>  rules:<br>  - host: myapp.com <br>    http:<br>      paths: <br>      - path: /<br>        backend:<br>          serviceName: myapp-internal-service<br>          servicePort: 3000</pre><pre>apiVersion: v1 <br>kind: Secret<br>metadata:<br>  name: myapp-secret-tls #!<br>data: <br>    tls.crt: base64 encoded cert<br>    tls.key: base64 encoded key<br>type: kubernetes.io/tls</pre><p>1. Data keys need to be named as “tls.crt” and “tls.key”<br>2. Values are file contents not paths/locations<br>3. Secret component must be in the same namespace as the Ingress component</p><p><strong>Helm Main Concepts:</strong></p><ul><li>Package manager for Kubernetes, packages yaml files and distributes them in public and private repositories.</li></ul><p><em>Helm Charts</em>, a collection of files that describe a related set of Kubernetes resources.<br>Templating Engine, define a common blueprint to be used as template.</p><p>Helm Chart Directory Structure;</p><pre>mychart/ #name of chart<br>  Chart.yaml #meta info about chart<br>  values.yaml #values for template files, default values can be overriden<br>  charts/ #chart dependencies<br>  templates/ #where actual template files stored<br>  ...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*Y5Q_yCmB2GF8C9h7E-_mZw.png" /></figure><pre>helm install [chartname]<br>helm upgrade [chartname]<br>helm rollback [chartname]</pre><p>Tiller has too much power inside of K8s cluster (create, delete, update) which causes security issues, so in Helm 3 Tiller got removed!</p><p><strong>Kubernetes Volumes:</strong><br>Storage that doesn’t depend on pod life cycle and available on all nodes and needs to survive even if cluster crashes.</p><p><em>Persistent Volume:</em> a cluster resource used to store data, created via yaml file, needs actual physical storage on local or remote, cloud environment.Use that storage in the spec section, specify capacity and parameters. <br>Persistent Volumes are accessible to the whole cluster. <br>Storage resource is provisioned by Kubernetes Admin.</p><p><em>Persistent Volume Claim: </em>created via yaml file, PVC claims a volume with specific size. Pod requests the volume through the PV Claim -&gt; Claim tries to find a volume in cluster -&gt; Volume has the actual storage backend. <br>Claims must be in the same namespace as the Pod using it! Volume is mounted into the Pod and when Pod dies, new Pod will be available to access the same storage. <br>Claim is provisioned by Kubernetes User.</p><p>Config Map and Secret are local volumes and not created via PV and PVC. You can mount these into Pod as needed. Different volume types can be used in a Pod by specifying different mount paths under the VolumeMounts.</p><p><em>Storage Class:</em> creates Persistent Volumes dynamically when PVC claims it. Also created via yaml file, defined in the storage class component via ‘provisioner’ attribute, each storage backend has own its provisioner.<br>Internal Provisioner — ‘kubernetes.io’</p><p>1. Pod claims storage via PVC <br>2. PVC requests storage from SC <br>3. SC creates PV that meets the needs of the PVClaim</p><p><strong>StatefulSet:</strong> <br>used for stateful applications (apps that stores data)</p><ul><li>stateless applications deployed using Deployment</li><li>stateful applications deployed using StatefulSet</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*Kh7eEE66W1MJkjnLG8dzqw.png" /></figure><p>Replica pods are not identical, each have their own identity, stateful set identifies a sticky identity for each pod, so even if the pod dies new one keeps the identity.</p><p>To avoid data inconsistency only one pod is allowed to change for both reading and writing which is called Master. <br>Replicas are not using the same physical storage, but they have to be synchorinized and have the same data. <br>The Worker must know about each change to be up-to-date!<br>When Master change its data Workers reach those changes.</p><p>With persistent storage, data will survive even if all pods die. PV lifecycle is not dependent to other cycles so for the StatefulSet a PV should be created.</p><p>Two characteristics;<br>1. predictable pod name #mysql-0<br>2. fixed individual DNS name #mysql-0.svc2</p><p>When Pod restarts;<br>1. IP Address changes<br>2. name and endpoint stays the same</p><p><strong>Kubernetes Services:</strong><br>Each pod has its own IP Address, everytime Pod gets recreated IP Address of it changes. <br>Service provides stable IP Address and LoadBalancing.</p><p><em>ClusterIP Services:</em> the default type, cluster internal ip addresses, service is accessible within the cluster.</p><pre>kubectl get pod -o wide #command to check pods ip address</pre><p>Once the request comes, it is directed to the service endpoints, pods are identified via selectors to be forwarded to. Port will be chosen via targetPort attribute.</p><pre>kubectl get endpoints</pre><p>K8s creates Endpoint object, same name as Service, keeps track of, which Pods are the members/endpoints of the Service.</p><p><em>Headless Service:</em> client wants to communicate with 1 specific Pod directly, not randomly selected, useful for stateful applications. Client needs to figure out IP addresses of each Pod, DNS Lookup ! returns single IP address as a solution here.</p><pre>ClusterIP: None #should be defined in the yaml file.</pre><p><em>NodePort Service: </em>creates a service that is accessible on a static port on each worker node in the cluster. External traffic has access to a fixed port on each worker node. Not secure for production!</p><p><em>LoadBalancer Service:</em> service becomes accessible externally through cloud providers LoadBalancer. Entrypoint becomes LB first and then traffic flows through NodePort so it will be more secure.</p><p><em>*Special thanks to Nana Janashia for this extremely helpful resource addressing Kubernetes beginners; </em><a href="https://www.youtube.com/watch?v=X48VuDVv0do"><em>https://www.youtube.com/watch?v=X48VuDVv0do</em></a><em> </em><a href="https://www.linkedin.com/in/nana-janashia/"><em>https://www.linkedin.com/in/nana-janashia/</em></a><em> learning deeply by following her courses and contents.</em></p><p><em>*Connect me from: </em><a href="https://www.linkedin.com/in/fatma-ecem-ozer/"><em>https://www.linkedin.com/in/fatma-ecem-ozer/</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a11841eb72a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>