authorjapps / wordcount-k8

Realtime Word Count Using Kubernetes, Kafka and EFK stack
1 stars 1 forks source link

[K8]Create a deployment file for deploying the WordCount app #3

Open authorjapps opened 4 years ago

authorjapps commented 4 years ago

AC1:

K8 Infra

authorjapps commented 4 years ago

Reference:

Connect to wc-app-cluster
Connect to your cluster using command line tooling to interact directly with cluster using kubectl, the command line tool for Kubernetes. Kubectl is available within the Azure Cloud Shell by default and can also be installed locally. Learn more

Open Cloud Shellor the Azure CLI
Run the following commands
az account set --subscription cd7b9393-ff87-457b-9728-7dfd635903c1
az aks get-credentials --resource-group K8RG --name wc-app-cluster
Sample commands
Once you have run the command above to connect to the cluster, you can run any kubectl commands. Here are a few examples of useful commands you can try.

# List all deployments in all namespaces
kubectl get deployments --all-namespaces=true
# List all deployments in a specific namespace
# Format :kubectl get deployments --namespace <namespace-name>
kubectl get deployments --namespace kube-system
# List details about a specific deployment
# Format :kubectl describe deployment <deployment-name> --namespace <namespace-name>
kubectl describe deployment my-dep --namespace kube-system
# List pods using a specific label
# Format :kubectl get pods -l <label-key>=<label-value> --all-namespaces=true
kubectl get pods -l app=nginx --all-namespaces=true
# Get logs for all pods with a specific label
# Format :kubecl logs -l <label-key>=<label-value>
kubectl logs -l app=nginx --namespace kube-system
Useful links
Overview of kubectl 
authorjapps commented 4 years ago

Set Kafka host and port as env variable. e.g.

docker run --rm \
--env KAFKA_HOST=kafka-k8 \
--env KAFKA_PORT=9096 \
authorjapps/wordcounter:latest