Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker/Kubernetes exercise

This repository holds results of Docker/Kubernetes exercise.

Dockerfile contains a set of instructions to build a Docker image that serves a web page with Nginx server.

The image repo for this exercise


The src directory contains files packed to the Docker image.


The python-src directory contains Python script to test that the container works as expected and requirements.txt file describing pip dependencies to run the script.


The test-task-chart directory contains Helm chart to deploy the image to k8s.

How to build

To build the image use the following command:

docker build -t <Docker Hub username>/<image name>[:tag] <Dockerfile directory> [--platform <platform name>]

Example of usage:

docker build -t samofimp/test-task-docker-kubernetes:1.0 . --platform amd64

Or, using Docker buildx, push and build:

docker buildx create --name <builder name> --use
docker buildx build --push --platform <list of platforms separated by comma> --tag <username>/<image name>:<tag> <Dockerfile directory>

Example of usage:

docker buildx create --name builder --use
docker buildx build --push --platform linux/arm64,linux/amd64 --tag samofimp/test-task-docker-kubernetes:1.0 .

How to push

Firstly, login to Docker registry with docker login. Then run this command:

docker push <username>/<image name>[:tag]

Or push image with docker buildx as shown above.

How to deploy

The test-task-chart chart was created from the default Helm chart (helm create <chart name>).

Some values are changed in accordance with the task requirements.

image:
  repository: samofimp/test-task-docker-kubernetes
  tag: "1.0"

service:
  type: ClusterIP
  port: 80

To deploy the chart run this command:

helm install <Helm release name> <path to test-task-chart directory> 

How to test

Install pip3 requirements described in requirements.txt file:

pip3 install -r requirements.txt

Download ChromeDriver according to your platform and Google Chrome version and add it to one of your $PATH directories.

Make port forward to the deployed k8s service:

kubectl port-forward service/<k8s service name> <local port>:<k8s service port> [-n <namespace if not default>]

Then run the Python script:

python3 test-connection.py http://localhost:<local port>

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages