25 Mayıs 2022 Çarşamba

minikube ssh seçeneği

WSL2 ve minikube beraber çalışıyorsa, minikube aslında bir docker container içinde her şeyi çalıştırıyor. Bu container'a bağlanmak için şöyle yaparız
$ minikube ssh
Last login: Fri Mar 18 12:54:31 2022 from 192.168.49.1
docker@minikube:~$
Örnek
Daha sonra koşan containerları görmek şöyle yapabiliriz
docker@minikube:~$ docker ps
Örnek
Docker image'ları görmek için şöyle yaparız
$ docker images
REPOSITORY                                TAG               IMAGE ID       CREATED         SIZE
planetscale/vitess-operator               latest            cc287b1529d3   5 weeks ago     194MB
vitess/lite                               v12.0.3-mysql80   272b8c7012d6   4 months ago    1.05GB
k8s.gcr.io/kube-apiserver                 v1.22.2           e64579b7d886   8 months ago    128MB
k8s.gcr.io/kube-controller-manager        v1.22.2           5425bcbd23c5   8 months ago    122MB
k8s.gcr.io/kube-scheduler                 v1.22.2           b51ddc1014b0   8 months ago    52.7MB
k8s.gcr.io/kube-proxy                     v1.22.2           873127efbc8a   8 months ago    104MB
kubernetesui/dashboard                    v2.3.1            e1482a24335a   11 months ago   220MB
k8s.gcr.io/etcd                           3.5.0-0           004811815584   11 months ago   295MB
kubernetesui/metrics-scraper              v1.0.7            7801cfc6d5c0   11 months ago   34.4MB
k8s.gcr.io/coredns/coredns                v1.8.4            8d147537fb7d   12 months ago   47.6MB
gcr.io/k8s-minikube/storage-provisioner   v5                6e38f40d628d   14 months ago   31.5MB
k8s.gcr.io/pause                          3.5               ed210e3e4a5b   14 months ago   683kB
quay.io/coreos/etcd                       v3.3.13           1e3509b14de0   3 years ago     36MB
prom/mysqld-exporter                      v0.11.0           e80442e91b90   3 years ago     17MB


24 Mayıs 2022 Salı

Kubernetes DNS Service

DNS Kayıtları

Fully Qualified Servis İsmi
Örnek 
Bir servisin detayına bakalım
> kubectl describe svc vt-etcd-global-peer
Name:              vt-etcd-global-peer
Namespace:         default
Labels:            etcd.planetscale.com/lockserver=vt-etcd-global
Annotations:       <none>
Selector:          etcd.planetscale.com/lockserver=vt-etcd-global
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                None
IPs:               None
Port:              peer  2380/TCP
TargetPort:        peer/TCP
Endpoints:         172.17.0.4:2380,172.17.0.7:2380,172.17.0.9:2380
Session Affinity:  None
Events:            <none>
Servisin bir çok endpoint'e eşleştiği görülebilir. Ancak name ile belirtilen servis ismi Fully Qualified değildir. Normalde Fully Qualified isim formatı şöyle. Nokta karakteri ile ayrılan 4 kısım
my-svc.my-namespace.svc.cluster-domain.example
veya şöyle
servicename.namespace.svc.cluster.local
Bu ismi görmek için nslookup kullanılabilir. Şöyle yaparız
# nslookup api-server
Server:     10.96.0.10
Address:    10.96.0.10#53

Name:   api-server.default.svc.cluster.local
Address: 10.104.225.18
api-server : servis ismi
default : servisin içinde bulunduğu namespace ismi
svc : sabit string
cluster.local : the default DNS domain for the cluster.

Örnek
Bir başka nslookup çıktısı şöyle
vt-etcd-global-1.vt-etcd-global-peer.default.svc.cluster.local
vt-etcd-global-2.vt-etcd-global-peer.default.svc.cluster.local
vt-etcd-global-3.vt-etcd-global-peer.default.svc.cluster.local
Kube DNS - Kullanmayın
Açıklaması şöyle
Kubernetes provides a built-in DNS service that can be used to resolve the hostnames of services and pods running within the cluster..... The IP address of the DNS service can be obtained using the kubectl get svc kube-dns --namespace kube-system command.
Core DNS
Açıklaması şöyle
Recent Kubernetes versions transitioned from kube-dns to CoreDNS to address security and stability concerns, with CoreDNS introduced in version 1.11. Both implementations function similarly:
Açıklaması şöyle
CoreDNS is a popular DNS server implementation used in Kubernetes for service discovery and DNS resolution. It is the default DNS server for Kubernetes and ensures pods and services have a Fully Qualified Domain Name (FQDN). CoreDNS is a flexible and extensible DNS server that is designed to be easily integrated into Kubernetes clusters and can be customized to support a wide range of use cases. Without CoreDNS the cluster's communication would cease to work.

In Kubernetes, CoreDNS is typically deployed as a pod in the cluster and is responsible for resolving DNS queries for services and pods. CoreDNS uses the Kubernetes API to retrieve information about services and pods and automatically generates DNS records for each of them.

One of the benefits of using CoreDNS in Kubernetes is that it is highly configurable, and can be extended to support custom plugins and DNS providers. For example, you can use CoreDNS plugins to add support for custom DNS zones or to integrate with external DNS providers.

Another benefit of CoreDNS is that it provides better performance and scalability than the previous default DNS server in Kubernetes, kube-dns. CoreDNS is written in Go and is designed to be lightweight and efficient, which makes it well-suited for handling large volumes of DNS queries in high-traffic Kubernetes environments.

To use CoreDNS in your Kubernetes cluster, you can deploy it as a pod using a Kubernetes manifest file or Helm chart. Once deployed, you can configure the CoreDNS server to meet your specific needs, such as by adding custom DNS providers, defining custom DNS zones, or integrating with other Kubernetes components such as Ingress or ExternalDNS.
etc/resolv.conf Dosyası - Resolving Shorter Hostnames and Searching Domains
Açıklaması şöyle
You won’t always need to utilize the whole hostname to access another service because of the search domain suffixes set in the resolv.conf file.
Örnek
Şöyle yaparız
nameserver 10.32.0.10
search namespace.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
Örnek
Açıklaması şöyle
If you’re contacting a service in the same namespace, you may just call it by its name
Şöyle yaparız
other-service
Örnek
Açıklaması şöyle
Add other-service to the query if the service is in a different namespace
Şöyle yaparız
other-service.other-namespace
Örnek
Açıklaması şöyle
You’ll need to utilize at least the following if you’re going after a pod
Şöyle yaparız
pod-ip.other-namespace.pod
Açıklaması şöyle
Only the .svc suffixes are automatically completed in the default resolv.conf file. Therefore, it is essential to specify the settings up to .pod.
SRV records
Açıklaması şöyle
So far we’ve only talked about resolving IP addresses using A-records. Kubernetes also uses SRV (service) records to resolve the port numbers of named services. This allows clients to discover the port numbers of services by querying the DNS server for the appropriate SRV record.
Şöyle yaparız
apiVersion: v1
kind: Service
metadata:
  name: nginx
  namespace: default
spec:
  ports:
    - port: 80
      name: http
Açıklaması şöyle
In this service, the container port 80 is exposed and is given the name “http”. Because the port is named, Kubernetes will generate an SRV record with the following name: _<port>._<proto>.<service>.<ns>.svc.<zone>.

In this case, the SRV record will be named _http._tcp.nginx.default.svc.cluster.local. A DNS query for this record would return the port number and IP address of the named service:
Açıklaması şöyle
Some services, such as Kerberos, use SRV records for the discovery of the KDC (Key Distribution Center) servers.
Şöyle yaparız
dig +short SRV _http._tcp.nginx.default.svc.cluster.local
0 100 80 10-129-1-26.nginx.default.svc.cluster.local.


GKE kind: ServiceExport - multi-cluster Services

Örnek
Şöyle yaparız
kind: ServiceExport
apiVersion: net.gke.io/v1
metadata:
  namespace: voip
  name: vt-etcd-global3


20 Mayıs 2022 Cuma

kubectl get secret seçeneği

Giriş
İsmi belirtilen secret bilgisini gösterir.

Örnek
İsmi example-cluster-config olan secret bilgisini görmek için şöyle yaparız. data bölümünde iki tane base64 secret görülebilir. İsimleri init.db.sql ve users.json
kubectl get secret example-cluster-config -o yaml
apiVersion: v1
data:
  init_db.sql: ...
  users.json: ewogICJ1c2VyIjogW3sKICAgICJVc2VyRGF0YSI6ICJ1c2VyIiwKICAgICJQYXNzd29yZCI6ICIiCiAgfV0KfQo=
kind: Secret
metadata:
  annotations:
  ...
Bir secret'ı değiştirmek için "kubectl edit secret" kullanılır


19 Mayıs 2022 Perşembe

minikube dashboard seçeneği

Kurulum
dashboard eklentisini normalde kurmaya gerek yok. Eklentileri listelemek için şöyle yaparız
$ minikube addons list
- addon-manager: enabled
- dashboard: enabled
- default-storageclass: enabled
- efk: disabled
- freshpod: disabled
- gvisor: disabled
- heapster: enabled
- ingress: disabled
- logviewer: disabled
- metrics-server: disabled
- nvidia-driver-installer: disabled
- nvidia-gpu-device-plugin: disabled
- registry: disabled
- registry-creds: disabled
- storage-provisioner: enabled
- storage-provisioner-gluster: disabled
Kurulu değilse dashboard eklentisini kurmak için şöyle yaparız
minikube addons enable dashboard 
Başlatmak
Dashboard eklentisini başlatmak için şöyle yaparız
minikube dashboard
Durdurmak için Ctrl + C'ya basarız

Cluster/Nodes Menüsü

Workloads/Deployments Menüsü



minikube profile seçeneği - Farklı Cluster İle Çalışmak İçindir

Giriş
Açıklaması şöyle. Yani aslında Profile ile Kubernetes Context aynı şey
In order to run multiple Kubernetes clusters locally, Minikube comes with the concept of profiles. For example, if you want to work with multiple versions of Kubernetes, you can create multiple Kubernetes clusters using Minikube. Each cluster will be assigned a separate Minikube profile. Most of the Minikube commands accept a –profile flag (or -p for short) that can be used to specify which of the Kubernetes clusters the command will be applied to. 
Açıklaması şöyle. Profile dosyaları  "~/.minikube/profiles" dizininde
If no profile is specified, either using the minikube profile command or the –profile switch, a default profile named minikube will be used.

Profile Değiştirme
Açıklaması şöyle.  
If you plan to work with one specific profile for a while, a more convenient alternative exists, where you specify the current profile with the following command:
Yani farklı bir Kubernetes cluster'ına bağlanmak için şöyle yaparız
minikube profile my-profile
Profile Listeleme
Şöyle yaparız
>minikube profile list
|----------|-----------|---------|--------------|------|---------|---------|-------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|---------|--------------|------|---------|---------|-------|
| minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.22.2 | Running |     1 |
|----------|-----------|---------|--------------|------|---------|---------|-------|
Profile İsmini Görme
Şimdiki profile ismini görmek için şöyle yaparız
minikube config get profile

minikube start seçeneği

--driver seçeneği
Örnek
Şöyle yaparız
$ minikube start --driver=docker
--nodes seçeneği
Normalde 1 node ile başlar. Sayısı artırmak mümkün.

Örnek
Şöyle yaparız
$ minikube start --nodes 3
Worker node sayısını görmek için şöyle yaparız
$ kubectl get nodes
NAME           STATUS   ROLES                  AGE   VERSION
minikube       Ready    control-plane,master   24m   v1.20.0
minikube-m02   Ready    <none>                 22m   v1.20.0
minikube-m03   Ready    <none>                 21m   v1.20.0
Bu örnekte minikube altta docker kullanıyor. Worker Node'lardan birisini durdurmak için şöyle yaparız
$ docker stop minikube-m03
--profile seçeneği
Örnek
Şöyle yaparız
minikube profile test
minikube start -p test
Örnek
Şöyle yaparız
unset KUBECONFIG    
minikube start \  
 --profile=handson-spring-boot-cloud \  
 --memory=10240 \  
 --cpus=4 \  
 --disk-size=30g \  
 --kubernetes-version=v1.20.5 \  
 --driver=docker \  
 --ports=8080:80 --ports=8443:443 \  
 --ports=30080:30080 --ports=30443:30443   
minikube profile handson-spring-boot-cloud  
  
minikube addons enable ingress  
minikube addons enable metrics-server
Açıklaması şöyle
The ports 8080 and 8443 will be used by the Ingress controller and the ports 30080 and 30443 will be used by Services of type NodePort.



kubectl expose seçeneği

Giriş
Açıklaması şöyle
Expose a resource as a new Kubernetes service.

Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port. [...]

1. deployment İçin
Tüm worker node'lar port açar. Pod'a erişmek için her hangi bir worker nodu'un IP adresini kullanılabilir.

Örnek - LoadBalancer
Şöyle yaparız
kubectl expose deployment your-deployment-name \ --type=LoadBalancer \ --port=80 \ --target-port=9092
Örnek - LoadBalancer
Şöyle yaparız
$ kubectl expose deployment 
  $( kubectl get deployment --selector="planetscale.com/component=vtgate" 
  -o=jsonpath="{.items..metadata.name}" ) 
  --type=LoadBalancer 
  --name=test-vtgate 
  --port 3306 
  --target-port 3306

$ kubectl get service test-vtgate
------
NAME         TYPE          CLUSTER-IP      EXTERNAL-IP      PORT(S)         AGE
test-vtgate  LoadBalancer  [cluster_ip]    [external_ip]    3306:32157/TCP  90s
2. pod İçin
Sadece tek bir pod'a port açar. Pod'a erişmek için bu pod'un çalıştığı worker node'un IP adresini kullanmak gerekir.

Örnek
Şöyle yaparız. nodePort numarası otomatik olarak veriliyor.
kubectl expose pod rabbitmq-0 --port=15672 --target-port=15672 --type=NodePort
Örnek - nodePort
Şöyle yaparız. Dahili 12340 portu dışarıya 30869 olarak açılır. nodePort numarası otomatik olarak veriliyor.
kubectl expose pod rlwy-proc-blue-6db5798f55-m2fmp --port=12340 --target-port=12340
  --type=NodePort --name imgw1
servisin detayları şöyledir. Burada IP: 172.30.135.252 yazıyor ama aslında bu IP adresi kullanılamaz. Bu pod'un çalıştığı worker node'un IP adresini kullanmak gerekir.
$  kubectl describe svc imgw1
Name:                     imgw1
Namespace:                rlwy-04
Labels:                   app=oce-rlwy-proc
                          chartColor=blue
                          ne=rlwy
                          pod-template-hash=6db5798f55
                          processingGroup=true
                          release=rlwy-04-oce-rlwy-proc-blue
                          runsCommManager=true
Annotations:              <none>
Selector:                 app=oce-rlwy-proc,...
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       172.30.135.252
IPs:                      172.30.135.252
Port:                     <unset>  12340/TCP
TargetPort:               12340/TCP
NodePort:                 <unset>  30869/TCP
Endpoints:                10.130.4.19:12340
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
Örnek - LoadBalancer
Bunu denemedim ama tahminen şöyle yaparız. Böylece bir pod dış dünyaya açılır
kubectl expose pod rlwy-proc-blue-6db5798f55-m2fmp --port=12340 --target-port=12340
--type=LoadBalancer --name imgw1 -n rlwy-04
servise bakınca şöyledir
$ kubectl get svc
NAME   TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)
imgw1  LoadBalancer   172.30.8.31      104.198.194.171  12340:31762/TCP
servisin detayları şöyledir
$ kubectl describe svc imgw1
Name:                     imgw1
Namespace:                rlwy-04
Labels:                   app=oce-rlwy-proc
                          chartColor=blue
                          ne=rlwy
                          pod-template-hash=6db5798f55
                          processingGroup=true
                          release=rlwy-04-oce-rlwy-proc-blue
                          runsCommManager=true
Annotations:              <none>
Selector:                 app=oce-rlwy-proc,chartColor=blue,...
Type:                     LoadBalancer
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       172.30.8.31
IPs:                      172.30.8.31
LoadBalancer Ingress:     104.198.194.171
Port:                     <unset>  12340/TCP
TargetPort:               12340/TCP
NodePort:                 <unset>  31762/TCP
Endpoints:                10.130.4.19:12340
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason                Age    From                Message
  ----    ------                ----   ----                -------
  Normal  EnsuringLoadBalancer  8m4s   service-controller  Ensuring load balancer
  Normal  EnsuredLoadBalancer   7m31s  service-controller  Ensured load balancer
Örnek - LoadBalancer
Şöyle yaparız
kubectl expose pod odsa-spring --type LoadBalancer --port 80 --target-port 8080

kubectl config use-context seçeneği - Named Cluster Multitenancy İçin Kullanılabilir

Giriş
Açıklaması şöyle. Yani context Kubernetes cluster'dan biraz daha fazla bir şeyi temsil ediyor. Context multitenancy için kullanılabilir.
A context is a combination of the following:
  • A Kubernetes cluster
  • Authentication information for a user
  • A default namespace
Açıklaması şöyle
By default, contexts are saved in the ~/.kube/config file, but the file can be changed using the KUBECONFIG environment variable. In this book, we will use the default location, so we will unset KUBECONFIG using the unset KUBECONFIG command.
Context vs Namespace
Context içinde farklı namespace olabilir

Context vs Cluster
Şöyle yaparız
>kubectl config get-clusters
NAME
minikube

Şimdiki Context'i Görmek
Örnek
Şöyle yaparız
kubectl config current-context
Context Listeme
kubectl config get-contexts yazısına taşıdım

Context Değiştirme
Örnek
Şöyle yaparız
kubectl config use-context gke_vitess-kubecon_europe-west_goodest-doggo-euwest4
Context Güncelleme
Örnek
Açıklaması şöyle
For example, to change the default namespace of the current context to my-namespace, use the following command:
In this command, kubectl config current-context is used to get the name of the current context.
Şöyle yaparız
kubectl config set-context $(kubectl config current-context) 
  --namespace my-namespace
Örnek
Şöyle yaparız. Burada yeni bir kullanıcı ve context yaratılıyor. 
$ kubectl config set-credentials rohan --client-certificate=rohan.crt 
  --client-key=rohan.key
User "rohan" set

$ kubectl config set-context rohan-context --cluster=minikube --namespace=space1 
  --user=rohan
Context "rohan-context" created
Yeni kullanıcıya role yaratıp bunları atıyoruz.
$ kubectl create role rohan-marketingweb --verb=get,list,update 
  --resource=pods,deployment,replicasets --namespace space1
role.rbac.authorization.k8s.io/rohan-marketingweb created

$ kubectl create rolebinding rohan-marketingweb-rolebinding --role=rohan-marketingweb
  --user=rohan --naspace space1
rolebinding.rbac.authorization.k8s.io/rohan-marketingweb-rolebinding created
Yeni context'e geçiyoruz
$ kubectl config use-context rohan-context
Switched to context "rohan-context"


kubectl delete seçeneği

Giriş
Belirtilen kaynağı siler

1. Pod
Söz dizilimi şöyle
kubectl delete pod <name>
Örnek
Şöyle yaparız.
kubectl delete pod/vttablet-demo-useast1-00003003
Troubleshooting Pods deletion
Açıklaması şöyle
If you delete a pod and it keeps coming back, chances are it is being controlled by some kind of replication set.

The types of replication sets that exist are:

Replicaset: used for basic replication and by deployments.
Statefulset: used for replication where not all replicas are exactly the same.
Daemonset: used for replication across all nodes, making sure each node in your cluster runs a certain pod.
These sets define the desired number of replicas for a given pod, so if you delete a running pod controlled by one of these, they will make sure a new pod gets scheduled in its place to meet the desired replicas defined in them.
Şöyle yaparız
# To check what is controlling your pod, you can use the kubectl get pods command:


$ kubectl get pods -o custom-columns="\
NAME:.metadata.name,\
CONTROLLED BY:.metadata.ownerReferences[*].name,\
TYPE:.metadata.ownerReferences[*].kind"
Açıklaması şöyle
In cases like these, you will need to scale down / delete the source resource which will in turn terminate the pod permanently.

As mentioned above, Deployments also use Replicasets so if you see a Replicaset then you might need to scale down the Deployment and not directly the Replicaset. You can view the owner reference of the Replicaset to see if it is standalone or has a further parent element.

--all seçeneği
Örnek
Şöyle yaparız
# To delete all pods in the default namespace, you can use the --all flag as follows
kubectl delete pod --all 

# To delete all pods in another namespace, you can add the 
# -n flag (short for --namespace) followed by the name of the namespace
kubectl delete pod --all -n staging
--dry-run=server seçeneği
Açıklaması şöyle
When using labels or field selectors to delete pods, you might want to verify which pods will be deleted by your command before actually deleting them.

To perform a dry run, you can use the --dry-run=server kubectl flag
Örnek
Şöyle yaparız
kubectl delete pod -l app=nginx --dry-run=server
pod "nginx-76d6c9b8c-sj76d" deleted (server dry run)
pod "web-0" deleted (server dry run)
--field-selector seçeneği - Deleting a Pod by field selector
Açıklaması şöyle
Pods can be deleted based on certain values using the --field-selector parameter. Similarly to deleting Pods by label, the field selector is a way to delete all pods matching a certain query.
Açıklaması şöyle
The current list of available field selectors is as follows:

metadata.name - the name of the Pod
metadata.namespace - the namespace of the Pod
spec.nodeName - the name of the Node the Pod is running on
spec.restartPolicy - the restart policy of the Pod
spec.schedulerName - the name of the Scheduler in charge of deploying the Pod
spec.serviceAccountName - the name of the service account the Pod is using
spec.hostNetwork - filter based on if the Pod is connected to the host’s network
status.phase - the lifecycle phase (status) of the Pod
status.podIP - filter based on the Pod’s IP
status.nominatedNodeName - filter based on the name of the Node that is the current “nominated” candidate to schedule the Pod.

For each of these fields, you can use the == or != comparison operators to filter the Pods that will be deleted.

Örnek
Şöyle yaparız. Running durumdaki tüm pod'ları siler
kubectl delete pod --field-selector=status.phase==Running
Örnek
Şöyle yaparız. node1 üzerinde çalışan ve Unknown durumdaki tüm pod'ları siler
kubectl delete pod --field-selector status.phase==Unknown,spec.nodeName=node1

-l seçeneği - Deleting Pod By Label
Açıklaması şöyle
There are times when it is easier to delete Pods by label—this can be because the label is constant and the name of the Pod can change, for example, in a Deployment. Deleting by label is easier for automation scripts in cases like these. Another reason could be if you want to delete many different pods sharing the same label whereas each pod would have a unique name.

To delete a pod by label, you can use the --selector flag or -l flag
Örnek
Şöyle yaparız
kubectl delete pod -l app=nginx

# You can also specify multiple labels by separating them with a comma as follows:
kubectl delete pod -l app=prometheus,component=exporter

# The above command will delete any pods with both label key values:

# app: prometheus
# component: exporter
--grace-period seçeneği
Açıklaması şöyle
By default, Kubernetes will wait 30 seconds for the Pod to complete any post-run hooks and for the main process to close after receiving the signal to terminate.

If you want to give the process more (or less) time, you can use the --grace-period flag
Söz dizilimi şöyle
kubectl delete pod <name> --grace-period=<seconds>
Açıklaması şöyle
Note that, 1 is the lowest number of seconds you can wait. Setting the value to a negative number will cause the flag to be ignored. 
Örnek - force
Açıklaması şöyle
Finally, setting the flag to 0 will skip the grace period (and hooks) altogether and can only be used together with the --force flag l
Söz dizilimi şöyle
kubectl delete pod <name> --grace-period=0 --force
Açıklaması şöyle
This combination will immediately remove the pod from Kubernetes without waiting for confirmation that the pod is terminated and the containers will be sent a signal to terminate immediately. This option should be used with care, as if there is an error which causes the container to not be deleted, for example, if a core service is not responding, then the containers might continue to run in the background without you seeing them in kubernetes.
--wait seçeneği
Açıklaması şöyle
By default, the kubectl command will hang the terminal until the object is fully removed. If the object has a large grace period this might take a while and you may want to do other things in your terminal in the meantime.

To skip the wait period, you can use the --wait=false flag 
Örnek
Şöyle yaparız
kubectl delete pod web-0 --wait=false
Örnek
Şöyle yaparız
kubectl delete pod web-0 --timeout=5s
Açıklaması şöyle
The above command will wait 5 seconds (notice the s suffix for seconds) and if the pod does not close within that amount of time, the kubectl delete command will be considered as failed and will display a timeout error in your terminal. Note that, this doesn't mean that the deletion wasn’t a success—your pods will continue to terminate in the background—this only means your pods were not entirely deleted in the specified time.
2. Deployment
Örnek
Şöyle yaparız.
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8080
kubectl port-forward service/hello-minikube 7080:8080

kubectl get deployment hello-minikube -o yaml

kubectl delete deploy hello-minikube
Örnek
Şöyle yaparız
kubectl delete deployment spring-boot-k8s

3. Service
Örnek
Şöyle yaparız
kubectl delete service spring-boot-k8s

kubectl get all seçeneği

Giriş
Tüm kaynakları listeler. Kaynaklar deployment, pod, service vs. gibi şeylerdir.

18 Mayıs 2022 Çarşamba

Minio

mc komutu - MinIO Client
Açıklaması şöyle
MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
Örnek
Şöyle yaparız
mc ls local

Cluster Propotional Autoscaler - ReplicaSet Ekler/Siler

Giriş Açıklaması şöyle CPA aims to horizontally scale the number of Pod replicas based on the cluster’s scale. A common example is DNS ser...