Skip to content
Diana Salamanca edited this page Mar 3, 2021 · 5 revisions

Welcome to the ft_services wiki!

This page is still under construction 🚧

Advice about how to start with this project

  1. Start building the databases MySQL, InfluDX (telegraf)
  2. Wordpress, PHPmyadmin, Grafana
  3. Nginx, ftps

Before start

A developer’s first interaction with Kubernetes is usually on a laptop, often with Minikube. Using Minikube, a single-node Kubernetes “cluster” can be deployed on locally as a virtual machine. Minikube supports a variety of different operating systems (OSX, Linux, and Windows) and Hypervisors (Virtualbox, VMware Fusion, KVM, xhyve, and Hyper-V). The following figure provides some details on setup with Minikube on a single host.

Image source

Basic commands

minikube

# Start
minikube start

# Display dashboard
minikube dashboard

# Stop minikube
minikube stop

# Display profile
minikube profile <"profile's name">

# Delete profile
minikube delete -p <"profile's name">

# List all params we can change
minikube config

# Display a list of global command-line options (applies to all commands)
minikube options

# List help options
minikube <"command"> --help

# Display current ip
minikube ip

# List available addons
minikube addons list

kubectl

⚠️ Before start using these commands, be sure minikube is running.

# Display all (namespaces, pods, etc)
kubectl get all

# List the current namespaces in a cluster
kubectl get namespaces

# List current pods:
kubectl get pods

# List all pods in ps output format with more information (such as node name):
kubectl get pods -o wide

# List the current deployments:
kubectl get deployments

# List the current services:
kubectl get services

# Display events with changes
kubectl get events -w

# Allow changing between namespaces. Without the name, it will list all namespaces available.
kubens <"namespace's name">

# Display IPs
kubectl get pod -o wide

Create Namespace / POD / Deployment / Service

  • From the terminal
# Using command line (for namespace)
kubectl create namespace <"namespace's name">

#Using YALM or JSON file
kubectl apply -f <"filename">
  • From Dashboard on a webpage

Delete Namespace / Pod / Deployment / Service

  • From the terminal
# Using command line (namespace/ pod)
kubectl delete namespace <"namespace's name">

# Using YALM or JSON file and command line
kubectl delete -f <"filename">
  • From Dashboard on a webpage

PODs/ Deployment details

# List the current pods in a cluster
kubectl get pods

# List the current deployment
kubectl get deployments

# List the deployment apps
kubectl get deployments.apps

# Display details about a pod/ service
kubectl describe pod <"pod name">
kubectl describe service <"service name">

# Display logs to see activity and if there are errors
kubectl logs -f <"e.g. pod name">

Access to PODs

# Using command line
kubectl exec -it <"pod's name"> -- /bin/bash

# Check which the Operating System is (inside the pod) 
cat /etc/*release

# List the available hosts(inside the pod)
cat /etc/hosts

# Display connection between two pods (inside the pod; before you had to create a service)
ping mariadb-service
#Kubernetes has an intern DNS, for that reason is able to resolve the connection between pods.

To check to see what was running on port

netstat -tulpn

Run on Windows

Using the docker motor inside the minikube

  1. Run in the terminal:
minikube docker-env
  1. To point your shell to minikube's docker-daemon, run:
minikube -p minikube docker-env | Invoke-Expression

Concepts

Kubernetes is an orchestrator for microservice apps

  • Masters: there are in charge
  • Nodes: are minions, they are doing the work We've got the code, and we containerize it. And, we define it in an object call a deployment, then we write it up and define it in a YAML file. Then we give the file to K8s on the master, and the master looks at the file and deploys the app on the cluster.

Namespaces

Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces.

When to Use Multiple Namespaces

Namespaces are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about namespaces at all.

Pod

  • A Pod is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.
  • Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
  • Pod is the minimum unit of work.
  • Kubernetes Pods are created and destroyed to match the state of your cluster. Pods are nonpermanent resources.
  • ReplicaSets create and destroy Pods dynamically
  • Kubernetes run containers always inside of pods.
  • A container without a pod in Kubernetes is a naked container.

Deployment

A Deployment provides declarative updates for Pods and ReplicaSets.

Services

A Service is an abstraction that defines a logical set of Pods and a policy by which to access them (sometimes this pattern is called a micro-service). The set of Pods targeted by a Service is usually determined by a selector. Es el punto de entrada, siempre es fijo.


Useful links

Kubernetes

MetalLB

Alpine

telegraf

:neckbeard::neckbeard::neckbeard::neckbeard:

VSFTPD (Very Secure File Transfer Protocol Daemon)

Grafana

Others

Mysql

Wordpress

PHP

Nginx

Configmap and secrets


Reverse Proxy