Skip to main content

Posts

Showing posts from September, 2023

Ansible with Azure

  Problem statement Create a Virtual Machine with the following configurations by using Ansible Script. Region: (US) East US Availability options: No infrastructure redundancy required Security type: Standard Image: Ubuntu Server 20.04 LTS - Gen2 Size: Standard_B2ms Authentication type: SSH public key SSH public key source: Generate new key pair OS disk type: Standard HDD Security Group: Inbound rule: Allow SSH, HTTP, and HTTPS Outbound rule: Allow All Notes Launch Both Azure Basics Lab and Ubuntu Challenge Lab in new tabs. You must click on the Credentials button on the top right corner of Ubuntu Challenge Lab to allow typing within the environment. Utilize Ubuntu Challenge Lab to perform an Ansible Script. Ansible and Python3 are already Installed in the Playground. Install rest of the required dependencies for ansible. Use the credentials given in the Azure Basics Lab to log in to the Azure Portal. After completing the hands-on, delete all the resources create

Kubernetes2

  Challenge 2 ConfigMaps: Step-1: To create a ConfigMap named 'fresco-config' with the key-value pair SERVER_URL= https://www.fresco.me , use the following command: kubectl create configmap fresco-config --from-literal=SERVER_URL=https://www.fresco.me To verify if the ConfigMap is created, use the following command: kubectl get configmap fresco-config Step-2: To create an nginx pod with the environmental variable SERVER_URL_ENV using the ConfigMap created earlier, use the following YAML template: apiVersion: v1 kind: Pod metadata: name: fresco-nginx-pod spec: containers: - name: fresco-nginx-container image: nginx env: - name: SERVER_URL_ENV valueFrom: configMapKeyRef: name: fresco-config key: SERVER_URL Deploy the above file you can name it deployment.yaml and use the command: kubectl apply -f deployment.yaml To test your configuration by executing the following command:

Kubernetes1

  Challenge 1 Welcome to the Kubernetes challenge, your task is to follow the below steps and complete them successfully. Environment Setup Check whether docker & minikube are properly installed and configured. Start Minikube and execute this command to sync host docker with minikube docker minikube -p minikube docker-env and eval $(minikube docker-env) Step-1 Create a pod object using kubectl run command with google's sample image: gcr.io/google-samples/kubernetes-bootcamp:v1 and expose it on port 8080, name the pod as firstapp. Check if the pod creation is successful by running the command: kubectl get pod firstapp Step-2 Expose the application to the local VM by creating a Service object of type NodePort. Check if the service is created by running the command: kubectl get svc firstapp Step-3 Create another deployment using a 'YAML' file, create a deployment.yaml file that contains information of the number of replicas and the images to be

Build Flask App(Kanbanboard) using Docker and Docker Compose

 A Kanban board is a project management tool designed to help visualize work, manage project tasks, workflows and communication. In this challenge, you are going to write the unit test cases for the given Kanban board Flask application using Pytest and deploy the application using Docker Compose. Instructions: 1. Write the unit test cases using Pytest testing framework in the following path 2. Refer 'test.py' file for further instructions. 3. Commands to Execute: - 'export FLASK APP-app.py' to set an environment variable. - 'python3 m flask run' to run the Flask application.  - 'python3 m pytest test.py' to run the test cases. 4. Once you done with test cases. Deploy the Kanban board Flask application in Docker using Docker Compose. 5. Create a 'Dockerfile' to dockerize the Kanban board Flask application with 'python alpine3.7 as its base image named 'kanbanboard_app_image".  6. Create 'docker-compose.yml file to create a s

Testing a Flask App

 Main.py from flask import Flask from flask_restful import Api, Resource, reqparse app = Flask(__name__) api = Api(app) @app.route("/") def hello_world():     return "<p>Hello, World!</p>" class DemoApiEndpoint(Resource):     def __init__(self):         self.post_args = reqparse.RequestParser()         self.post_args.add_argument("name",                                     type=str,                                     help="You must include a name string with this post request.",                                     required=True)     def get(self):         return {             "message": "This is a response from a GET request."         }     def post(self):         args = self.post_args.parse_args()         name = args['name']         return {             "message": f'Nice to meet you, {name}!'         } api.add_resource(DemoApiEndpoint, "/api/DemoApiEndpoint") if __name__ ==