{"id":28644986,"url":"https://github.com/clever-cottonmouth/docker-kubernetes","last_synced_at":"2025-06-13T00:33:14.674Z","repository":{"id":283841861,"uuid":"953071554","full_name":"clever-cottonmouth/Docker-Kubernetes","owner":"clever-cottonmouth","description":"docker for ecommerce microservice","archived":false,"fork":false,"pushed_at":"2025-04-22T06:26:09.000Z","size":8,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T07:35:00.003Z","etag":null,"topics":["docker","docker-compose"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clever-cottonmouth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-22T14:02:51.000Z","updated_at":"2025-04-22T06:37:38.000Z","dependencies_parsed_at":"2025-05-21T07:35:04.158Z","dependency_job_id":"ab85000a-37f0-40de-963e-dd31d39f219c","html_url":"https://github.com/clever-cottonmouth/Docker-Kubernetes","commit_stats":null,"previous_names":["mirajhad/docker-ecommerce","mirajhad/docker-kubernetes","clever-cottonmouth/docker-kubernetes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clever-cottonmouth/Docker-Kubernetes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clever-cottonmouth%2FDocker-Kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clever-cottonmouth%2FDocker-Kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clever-cottonmouth%2FDocker-Kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clever-cottonmouth%2FDocker-Kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clever-cottonmouth","download_url":"https://codeload.github.com/clever-cottonmouth/Docker-Kubernetes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clever-cottonmouth%2FDocker-Kubernetes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259554918,"owners_count":22875896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose"],"created_at":"2025-06-13T00:31:31.760Z","updated_at":"2025-06-13T00:33:14.663Z","avatar_url":"https://github.com/clever-cottonmouth.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploy an Azure Kubernetes Service (AKS) cluster using Azure CLI\nLogin to specific tenant (from Entra ID)\n```   \naz login --tenant \u003cTENANT_ID\u003e\n    az login --tenant 8ae4526f-98aa-4bcc-b9c8-abd102c7d981\n```\n\nCreate resource group\n```\naz group create --name ecommerce-resource-group --location \"South India\"\n```\n\nCreate container registry\n```\naz acr create --resource-group ecommerce-resource-group --name mirajecommerceregistry --sku Basic\n```\n\nRegister Microsoft.Insights Resource Provider, which is required for Cluster monitoring:\n```\naz provider register --namespace Microsoft.Insights \naz provider register --namespace Microsoft.OperationalInsights   \naz provider register --namespace Microsoft.ContainerService   \naz provider register --namespace Microsoft.Network \naz provider register --namespace Microsoft.Compute   \naz provider register --namespace Microsoft.OperationsManagement   \naz provider register --namespace Microsoft.Authorization   \naz provider register --namespace Microsoft.Storage \n```\nMicrosoft.Insights: Enables monitoring and diagnostics for Azure resources.\nMicrosoft.OperationalInsights: Supports Log Analytics for operational data monitoring.\nMicrosoft.ContainerService: Manages Azure Kubernetes Service (AKS) and container workloads.\nMicrosoft.Network: Provides network-related services like VNETs, Load Balancers, and VPNs.\nMicrosoft.Compute: Manages virtual machines, scale sets, and related compute resources.\nMicrosoft.OperationsManagement: Handles operations management solutions, like Azure Automation.\nMicrosoft.Authorization: Manages access control (RBAC) and policy settings for resources.\nMicrosoft.Storage: Manages Azure Storage services like blobs, files, and queues.\n\n\n\nCreate AKS cluster:\n```\naz aks create --resource-group ecommerce-resource-group --name ecommerce-aks-cluster --node-count 1 --node-vm-size Standard_B2s --enable-addons monitoring --generate-ssh-keys\n```\n--node-count 1\n\nNode Count: Specifies the number of nodes (virtual machines) in your AKS cluster.\nNodes: Each node is a VM that runs your Kubernetes workloads (containers).\nIn this command, --node-count 1 means the cluster will have 1 nodes. You can add more; for example \"5\" if you need more resources in real world projects. You can update it later, if needed.\n\nDefault: Standard_B2s:\nvCPUs: 2\nMemory: 8 GB\nTemporary Storage: 4 GB\nUse Case: Cost-effective for burstable workloads where CPU usage is not consistent but needs to handle spikes in demand.\n\nOther Options:\nStandard_DS2_v2: A more powerful VM, suitable for production workloads.\nStandard_E8s_v3: High memory VMs for memory-intensive application\n\n--enable-addons monitoring\n\nEnable Addons: This flag is used to enable additional features in your AKS cluster.\n\nMonitoring: In this case, monitoring refers to enabling Azure Monitor for containers, which provides insights and monitoring capabilities for your Kubernetes cluster.\n\nEven for learning purposes, it's useful to enable monitoring so you can observe the performance and behavior of your applications and the Kubernetes cluster itself.\n\n\n--enable-managed-identity: \nThis enables a system-assigned managed identity for the AKS cluster, which is useful for securely accessing Azure resources in your AKS cluster.\n\n\n--generate-ssh-keys\n\nSSH Keys: Secure Shell (SSH) keys are used to securely access the virtual machines (nodes) in your cluster.\n\nIf you need to troubleshoot or manage the individual nodes (VMs), SSH keys allow you to securely connect to them.\n\nSSH keys are a way to securely access remote nodes (VMs) without needing to type in a password each time. They work using a pair of keys:   \n\nPublic Key: This key is placed on the remote server you want to access. It's like leaving a padlock on the server's door.   \nPrivate Key: This key stays on your computer and is kept secret. It's like the key to the padlock you left on the server.\n\nWhen you want to connect, your computer uses your private key to prove it has the right to unlock the padlock (the public key) on the server. This allows you to log in to the node (VM) without a password.   \n\n\n\nEnable \"kubectl\" command:\n```\naz aks get-credentials --resource-group ecommerce-resource-group --name ecommerce-aks-cluster\n```\nThis command fetches the credentials and configuration details for your AKS cluster and updates your local kubeconfig file. \nIt allows your local machine to connect to the AKS cluster and use kubectl to manage it. \nBy running this, you enable your local Kubernetes client to interact with your cluster, making it possible to deploy and manage applications from your local setup.\n\n\nGet cluster info:\n```\nkubectl cluster-info\n```    \nThis command provides information about the Kubernetes cluster you are currently connected to. \n\n\nkubectl Quick Reference: https://kubernetes.io/docs/reference/kubectl/quick-reference/\n\n    kubectl [or] kubectl --help\n\nGet current cluster name [Optional]:\n```\nkubectl config current-context\n```\n\n\n\n## Kubectl Basic Command\n\nGet list of nodes in your cluster:\n```\nkubectl get nodes\n```\n\nThis should return a list of nodes in your AKS cluster.\nWe've created the cluster with two worker nodes.\n\n\nGet list of namespaces in your cluster:\n```\nkubectl get namespaces\n```\n\nLists all namespaces. Namespaces provide a way to divide cluster resources between multiple users or teams.\nYou will have to create one namespace for each set of resources (such as Pods) that need to be managed by a user or a team.\n\nNamespaces in Kubernetes are a way to divide a single cluster into multiple virtual clusters. \n    \nThey help organize and manage resources, allowing different teams or applications to share the same cluster without interfering with each other. \n    \nBy using namespaces, you can isolate resources like pods and services, set resource quotas, and apply policies separately for each namespace. This makes it easier to manage and secure resources within a large, shared Kubernetes environment.\n\n## Deployment Commands\n```\naz login\naz acr login --name mirajecommerceregistry\n```\n\nTO DO: Create the deployment file (deployment.yaml)\n### Deployment yaml file\n```\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: demowebapp-deployment\n  labels:\n    app: demo-webapi-app\n    environment: development\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: demowebapp\n  template:\n    metadata:\n      labels:\n        app: demowebapp\n    spec:\n        containers:\n            - name: demowebapp-container\n              image: mirajecommerceregistry.azurecr.io/demowebapp:latest\n              ports:\n               - containerPort: 80\n              env:\n               - name: ASPNETCORE_ENVIRONMENT\n                 value: Development\n```\n\n```\ncd c:\\azure\\DemoWebApplicationSolution\n\ndocker build -t demowebapp:latest -f ./DemoWebApplication/Dockerfile .\n\ndocker tag demowebapp:latest harshaecommerceregistry.azurecr.io/demowebapp:latest\n\ndocker push mirajecommerceregistry.azurecr.io/demowebapp:latest\n```\n\nAttach ACR to the cluster (Grant the AKS managed identity the AcrPull role on the ACR):\n```    \naz aks update --resource-group ecommerce-resource-group --name ecommerce-aks-cluster --attach-acr mirajecommerceregistry\n```\n\nApply the deployment yaml file:\n```\ncd DemoWebApplication\nkubectl apply -f deployment.yaml\n```\n\nGet list of deployments in the current namespace:\n```\nkubectl get deployments\n```\nLists all deployments in the current namespace.\nA deployment in Kubernetes is a resource that manages the creation, updating, and scaling of a set of replicas of a pod. It ensures that the desired number of pod replicas are running and provides rolling updates and rollback capabilities to maintain application availability and consistency.\n\n\nGet deployment details:\n```\nkubectl describe deployment demowebapp-deployment\n```\n\nGet list of pods in your cluster:\n```\nkubectl get pods\n```\n\nGet list of pods of a specific deployment:\n```\nkubectl get pods --selector=app=demowebapp\n```\n\nGet list of containers in a pod:\n```\nkubectl describe pod demowebapp-deployment-856cff9945-5k6p8\n```\n\nGet logs of first container of a pod:\n```\nkubectl logs demowebapp-deployment-856cff9945-5k6p8\n```\n\nGet logs of specific container in a pod:\n```\nkubectl logs demowebapp-deployment-856cff9945-5k6p8 -c demowebapp-container\n```\n\nDelete a deployment:\n```\nkubectl delete deployment demowebapp-deployment --namespace default\n```\n\n\n[Not necessary]\nAdd managed-identity on existing cluster:\n```\naz aks update --resource-group demo-resource-group --name ecommerce-aks-cluster --enable-managed-identity\n```\n\n# Service Commands\n\nApply service:\n```\nkubectl apply -f service.yaml\n```\n//TODO:creating service.yaml\n```\napiVersion: v1\nkind: Service\nmetadata:\n  name: demowebapp-service\nspec:\n  type: LoadBalancer\n  selector:\n    app: demowebapp\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 8080\n\n```\n\nGet list of services in your cluster:\n```\nkubectl get services\n```\nServices provide a stable endpoint for accessing pods.\nGet service details:\n```\nkubectl get service demowebapp-service\n```\n\nGet more service details:\n```\nkubectl describe service demowebapp-service\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever-cottonmouth%2Fdocker-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclever-cottonmouth%2Fdocker-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever-cottonmouth%2Fdocker-kubernetes/lists"}