IT Cloud. Eugeny ShtoltcЧитать онлайн книгу.
of which can be NGINX settings:
#secrets
apiVersion: v1
kind: Secrets
metadata: name: test_secret
data:
password: ....
And to add a secret to POD, you need to specify it in the POD config:
....
valumes:
secret:
secretName: test_secret
…
Kubernetes has more flavors of Volumes:
* emptyDir;
* hostPatch;
* gcePersistentDisc – drive on Google Cloud;
* awsElasticBlockStore – A disk on Amazon AWS.
volumeMounts:
– name: app
nountPath: ""
volumes:
– name: app
hostPatch:
....
Feature for UI: Dashbord UI
Additionally available:
* Main metrics – collection of metrics;
* Logs collect – collecting logs;
* Scheduled JOBs;
* Autentification;
* Federation – distribution by data centers;
* Helm is a package manager similar to Docker Hub.
https://www.youtube.com/watch?v=FvlwBWvI-Zg
Docker commands
Docker is a more modern counterpart to RKT containers.
In Linux, when a process terminates with PID = 1, then NameSpace is also buried, which leads to the shutdown of the OS, in the case of a container, similarly, since it is a special case of the OS. The delimitation of processes in itself does not provide additional overhead, as well as monitoring and limiting resources for processes, because systemd provides the same configuration options in the host OS. Network virtualization occurs completely: both localhost and bridge, which allows you to create bridges from several containers to one localhost and thereby make it a single one for them, which is actively used in POD Kubernetes.
Run a temporary container interactively -it . To enter, you need to press Ctrl + D, which will send a signal to shutdown, after which it will be removed by –rm to avoid clogging the system with stopped modern containers. If the image is created in such a way that the application is launched in the shell in the container, which is wrong, then the signal will be poisoned to the application, and the container will continue to work with the shell, in which case, to exit in a separate terminal, you will need to kill it by its name –name name_container. For instance,:
Docker run –rm -it –name name_container ubuntu BASH
In the beginning, the Docker CLI had a simple set of commands to manage the lifecycle of containers. Among them:
* Docker run to run the container;
* Docker ps to view running containers;
* Docker rm to remove a container;
* Docker build to create your own image;
* Docker images to view existing containers;
* Docker rmi to remove the image.
But with the growing popularity, the teams became more and more and it was decided to group them into groups, so instead of the simple "Docker run", the "Docker container" command appeared, which has 25 commands in the 19 version of Docker. These are cleanup, and stop and restore, and logs and various kinds of container connections. The same fate befell the work with images. But, the old commands have remained so far due to compatibility and convenience, because in most cases a basic set is required. Let's stop at it:
Starting a container:
docker run -d –name name_container ubuntu bash
Remove a running container:
docker rm -f name_container
Output of all containers:
docker ps -a
Output of running containers:
docker ps
Output of containers with consumed resources:
docker stats
Displaying processes in a container:
docker top {name_container}
Connect to the container through the sh shell (there is no BASH in alpine containers):
docker exec -it sh
Cleaning the system from unused images:
docker image prune
Remove hanging images:
docker rmi $ (docker images -f "dangling = true" -q)
Show image:
docker images
Create image in dir folder with Dockerfile:
docker build -t docker_user / name_image dir
Delete image:
docker rmi docker_user / name_image dir
Connect to Docker hub:
docker login
Submit the latest revision (the tag is added and shifted automatically, if not specified otherwise) the image on the Docker hub:
docker push ocker_user / name_image dir: latest
For a broader list at https://niqdev.github.io/devops/docker/.
Building a Docker Machine can be described in the following steps:
Creating a VirtualBox virtual machine
docker-machine create name_virtual_system
Creating a generic virtual machine
docker-machine create -d generic name_virtual_system
List of virtual machines:
docker-machine ls
Stop the virtual machine:
docker-machine stop name_virtual_system
Start a stopped virtual machine:
docker-machine start name_virtual_system
Delete virtual machine:
docker-machine rm name_virtual_system
Connect to virtual machine:
eval "$ (docker-machine env name_virtual_system)"
Disconnect Docker from VM:
eval $ (docker-machine env -u)
Login via SSH:
docker-machine ssh name_virtual_system
Quit the virtual machine:
exit
Run the sleep 10 command in the virtual machine:
docker-machine ssh name_virtual_system 'sleep 10'
Running commands in BASH environment:
docker-machine ssh dev 'bash -c "sleep 10 && echo 1"'
Copy the dir folder to the virtual machine:
docker-machine scp -r / dir name_virtual_system: / dir
Make a request to the containers of the virtual machine:
curl $ (docker-machine ip name_virtual_system): 9000
Forward port 9005 of host machine to 9005 virtual machine
docker-machine ssh name_virtual_system -f -N -L 9005: 0.0.0.0: 9007
Master initialization:
docker swarm init
Running