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 [2024/03/05 19:41] skipidardevops:docker:kubernetes [2024/07/21 14:33] (current) skipidar
Line 141: 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 150: 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 976: 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.1709667692.txt.gz · Last modified: by skipidar