16 Eylül 2021 Perşembe

Kubernetes Servis Nedir?

Giriş
Açıklaması şöyle. Dış dünyaya açılan yüzümüz diye düşünebiliriz.
A Service enables network access to a set of Pods in Kubernetes.

Services select Pods based on their labels. When a network request is made to the service, it selects all Pods in the cluster matching the service's selector, chooses one of them, and forwards the network request to it.
Service ve Deployment Farkı Nedir?
Açıklaması şöyle.
A deployment is responsible for keeping a set of pods running.
A service is responsible for enabling network access to a set of pods.
Servis Tipleri Nedir?
Açıklaması şöyle
The type property in the Service's spec determines how the service is exposed to the network. It changes where a Service is able to be accessed from. The possible types are ClusterIP, NodePort, and LoadBalancer

- ClusterIP – The default value. The service is only accessible from within the Kubernetes cluster – you can’t make requests to your Pods from outside the cluster!

- NodePort – This makes the service accessible on a static port on each Node in the cluster. This means that the service can handle requests that originate from outside the cluster.

- LoadBalancer – The service becomes accessible externally through a cloud provider's load balancer functionality. GCP, AWS, Azure, and OpenStack offer this functionality. The cloud provider will create a load balancer, which then automatically routes requests to your Kubernetes Service
servisleri görmek için kubectl get services kullanılır

ClusterIP Service yazısına bakabilirsiniz
LoadBalanceService yazısına bakabilirsiniz
IngressService yazısına bakabilirsiniz


Kubernetes Pod Nedir?

Giriş
Pod, Kubernetes mimarisinde Kubernetes Node'un bir parçası. Kısaca container'ları çalıştırır deyebiliriz.

Açıklaması şöyle. Aslında bir pod birden fazla docker container çalıştırabilir. Açıklaması şöyle
The primary reason that Pods can have multiple containers is to support helper applications that assist a primary application. Typical examples of helper applications are data pullers, data pushers, and proxies. Helper and primary applications often need to communicate with each other. Typically this is done through a shared filesystem, as shown in this exercise, or through the loopback network interface, localhost. An example of this pattern is a web server along with a helper program that polls a Git repository for new updates. 
Ancak bu tavsiye edilmediği için pod = container gibi düşünülebilir.
The containers are called as ‘Pod’ in Kubernetes terms. So a single Kubernetes node can have multiple containers.
Pod örneğin bir servis olabilir.
Kubernetes Servis Nedir? yazısına bakabilirsiniz

Örnek
Buradaki şekilde aynı Pod içinde çalışan farklı container'lar görülebilir.

15 Eylül 2021 Çarşamba

chpasswd komutu

Örnek
gitlab-ci isimli kullanıcının şifresini changemepassword yapmak için şöyle yaparız
echo 'gitlab-ci:changemepassword' | chpasswd

anacron

Giriş
Açıklaması şöyle
On many systems, if you turn your computer off at night and boot it or wake it up from suspension in the morning, it'll run various daily jobs, via anacron. This starts a few minutes after the computer wakes up, so you'd typically have time to log in but the resource usage would intensify after a few minutes. Anacron jobs are configured in /etc/anacrontab; a common configuration is for it to run the jobs listed in /etc/cron.daily. Maybe one of these jobs is using an unreasonable amount of resources for some reason. Use a tool like pstree to check what children of anacron are running.

13 Eylül 2021 Pazartesi

Kubernetes Configuration Examples

Giriş
Konfigürasyon için iki yöntem var
1. Environment variable
2. ConfigMap
Her iki yöntem de Pod, Service veya herhangi bir başka Kubernetes kind için kullanılabilir.

1. Environment variable
env başlığı altında
- name + value 
- name + valueFrom + configMapKeyRef
- name + valueFrom + secretKeyRef
şeklinde kullanılır

Örnek
Şöyle yaparız
apiVersion: v1
kind: Pod
metadata:
  name: static-web
  labels:
    role: myrole
spec:
  containers:
  - name: nginx
    image: nginx
    env:
    - name: DB_NAME
      value: MyDB
    - name: DB_URL
      valueFrom:
        configMapKeyRef:
          name: config-url
          key: db_url
    - name: DB_PASSWORD
      valueFrom:
        secretKeyRef:
          name: config-passwd
          key: db_password
2. ConfigMap
Kubernetes ConfigMap yazısına taşıdım

12 Eylül 2021 Pazar

gnome-disks komutu

Giriş
Bu komutu ilk olarak burada gördüm.

/usr/local Dizini - Kaynak Kod İle Yapılan Kurulumlar

Giriş
/usr/local paket yöneticisi (package manager) uygulamalarda tarafından dikkate alınmaz.

/usr/local vs /opt
Paket yönetimine dahil olmadığı için kaynak kod derlenerek yapılan kurulumlar için kullanılabilir. Açıklaması şöyle. Kendi geliştirdiğimiz şeyleri de /usr/local/bin altına koyabiliriz.
Since these software projects are installed by extracting a .tar.gz file it sounds like they are self-contained applications and I would install them in /opt/<project>. Another common choice is /usr/local, but I prefer that for source based installs.