Skip to content

liuning0820/kubernetes-k8s-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes K8S Basic

What's Kubernetes

Kubernetes 用于自动部署,扩展和管理容器化应用程序的开源系统。

  • 生产级别的容器编排系统
  • 数据中心OS
  • 新生代的云平台

Kubernetes Cluster

A Kubernetes cluster consists of two types of resources:

  • The Master coordinates the cluster
  • Nodes are the workers that run applications

Create Cluster - minikube

Manage Cluster - kubectl

kubectl is the Kubernetes Command Line Interface (CLI) client to manage Kubernetes cluster resources and applications.

install-kubectl

# Check the installation
kubectl version

# view the cluster details
kubectl cluster-info
# view the nodes in the cluster
kubectl get nodes

Kubernetes Deployment

# using kubectl to create deployment
kubectl create -f azure-vote.yaml
kubectl apply -f azure-vote.yaml
kubectl run Name --image=image [--port=port]
kubectl get deployments

Kubernetes Pods

When you created a Deployment, Kubernetes created a Pod to host your application instance. A Pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker), and some shared resources for those containers.

# list resources
kubectl get pods
# show detailed information about a resource
kubectl describe pods
# print the logs from a container in a pod
kubectl logs $POD_NAME
# execute a command on a container in a pod
kubectl exec -ti $POD_NAME bash

Play Azure Kubernetes Service (AKS)

AKS Tutorial

# install kubectl
az aks install-cli
# check kubectl version
kubectl version
# connect to cluster using kubectl
az aks get-credentials --resource-group aks-basic --name aks-basic-cluster
# verify connection to cluster
kubectl get nodes
# get the external IP of the service, open browser to test the app.
kubectl get service azure-vote-front
# Access Kubernetes dashboard with aks
az aks browse --resource-group aks-basic --name aks-basic-cluster