User Tools

Site Tools


devops:docker:kubernetes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devops:docker:kubernetes [2023/11/22 21:02] – [Kubernetes] skipidardevops:docker:kubernetes [2024/07/21 14:33] (current) skipidar
Line 15: Line 15:
 Glossary Glossary
 |Pod|Smallest unit of K8s. Can contain multiple containers {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/ZS1pEtKqtQ.png?300px}}| |Pod|Smallest unit of K8s. Can contain multiple containers {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/ZS1pEtKqtQ.png?300px}}|
 +|ReplicaSet| **Orchestrated by deployments.** A ReplicaSet ensures that a **specified number of pod replicas are running at any given time**. However, a Deployment is a higher-level concept that manages ReplicaSets and provides declarative updates to Pods along with a lot of other useful features. {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/1a1gqMxnuj.png?300px}}|
 +|Deployments|Manages your Pods. The Deployment object not only creates the pods but also ensures the correct number of pods is always running in the cluster, handles scalability, and takes care of updates to the pods on an ongoing basis.  {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/IIQ1Hpm0Bd.png?300px}}|
 +|Services|Write traffic to Pods. Visible inside the cluster {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/jgduvQSMHM.png?300px}}|
 +|Ingress|Make Service visible over the internets {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/jgduvQSMHM.png?300px}}|
 +|Secrets| Store SENSITIVE data and files to map those into the container {{https://s3.eu-central-1.amazonaws.com/alf-digital-wiki-pics/sharex/cYujcjPS5e.png?300px}}|
  
  
Line 136: Line 141:
 ==== Vagrant environment ==== ==== Vagrant environment ====
 Use the Vagrant environment for the experiments Use the Vagrant environment for the experiments
-https://github.com/skipidar/Vagrant-Kubernetes+<del>https://github.com/skipidar/Vagrant-Kubernetes</del> 
 + 
 +https://github.com/alfrepo/Vagrant_Templates/tree/master/Workspace
  
  
Line 145: Line 152:
  
  
-=== On Windows - Dont deploy in minikube=== +=== Prefered: On Windows - do use minikube=== 
-Why not Minukube: the **minikube** may only be started from disk C:\ Otherwise it will throw an errorthat it does not recognize the path.+ 
 +- install "Docker Desktop" 
 +- install minikube directly on Windowsin order not to mess around with port forwarding etc. 
 + 
 +see 
 +https://wiki.alf.digital/doku.php?id=devops:docker:kubernetes:tutorial-win-minikube 
  
 +=== Alternative: On Windows - Deploy in Linux-guest Vagrant VM - Minikube distribution ===
  
-=== On Windows - Deploy in Linux-guest Vagrant VM - Minikube distribution ===+Challenges: redirecting the minikube console etc. is challenging.
  
 OS: Ubuntu OS: Ubuntu
Line 971: Line 985:
  
 https://github.com/Apress/Kubernetes-Native-Development/blob/main/snippets/chapter1/webserver-deployment.yaml https://github.com/Apress/Kubernetes-Native-Development/blob/main/snippets/chapter1/webserver-deployment.yaml
 +
 +
 +Generate deployment config with a service.
 +
 +<sxh shell>
 +kubectl create deployment demo --image=springguides/demo --dry-run -o=yaml > deployment.yaml
 +echo --- >> deployment.yaml
 +kubectl create service clusterip demo --tcp=8080:8080 --dry-run -o=yaml >> deployment.yaml
 +</sxh>
 +
 +
 +Generated deployment config:
 +
 +<sxh shell>
 +
 +apiVersion: apps/v1
 +kind: Deployment
 +metadata:
 +  creationTimestamp: null
 +  labels:
 +    app: demo
 +  name: demo
 +spec:
 +  replicas: 1
 +  selector:
 +    matchLabels:
 +      app: demo
 +  strategy:
 +    type: RollingUpdate
 +  template:
 +    metadata:
 +      creationTimestamp: null
 +      labels:
 +        app: demo
 +    spec:
 +      containers:
 +      - image: springguides/demo
 +        name: demo
 +        resources: {}
 +status: {}
 +</sxh>
 +
 +
 +Lets go step by step through the config:
 +<sxh shell>
 +
 +metadata:
 +  creationTimestamp: null
 +  labels:
 +    app: demo
 +  name: demo
 +
 +Assign label "app". Value: demo
 +Labels help identify and categorize resources. By assigning specific labels, you can easily distinguish between different types or groups of resources within your cluster. 
 +
 +
 +
 +
 +spec:
 +  replicas: 1
 +  selector:
 +    matchLabels:
 +      app: demo
 +
 +In the provided Kubernetes deployment specification, the selector section defines a criteria for matching Pods to the deployment. Let's break it down:
 +
 +selector: 
 +This key signifies the start of the selector configuration within the deployment spec.
 +
 +matchLabels: 
 +This key specifies that the selector will use labels for matching.
 +
 +app: demo: 
 +This entry defines the actual matching criteria. It specifies that the selector will only consider Pods with a label named app and a value of demo.
 +
 +
 +
 +
 +
 +spec:
 +  replicas: 1
 +    spec:
 +      containers:
 +      - image: springguides/demo
 +        name: demo
 +        resources: {}
 +
 +This defines the name assigned to the container within the Pod.
 +
 +</sxh>
 +
  
  
devops/docker/kubernetes.1700686936.txt.gz · Last modified: by skipidar