- Initialize the cluster
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.33.242 --kubernetes-version stable-1.11 -v 10
- View the logs
kubectl logs -f kubernetes-dashboard-767dc7d4d-f8r8l -n kube-system
- Forward the port
kubectl port-forward pod/guids-796989bbbb-qj2nl 9000:9000
- Expose the port (By NodePort)
kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
kubectl expose deployments hello-world
- Label a pod
kubectl label pod guids-796989bbbb-qj2nl app=guids
kubectl get pods -l app=guids
- Tear down the cluster
kubectl drain neo --delete-local-data --force --ignore-daemonsets
kubectl delete pod,service baz foo
- Re-add the node
service kubelet restart
kubectl uncordon neo
- Various get
kubectl get nodes
kubectl get pods
kubectl get services
kubectl get deployments -o wide
kubectl get all -n kube-system
kubectl get storageclass
kubectl api-resources
- Describe
kubectl describe services guids
- Create a deployment
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=neocxf/hello-world --port=8080
- View the pod name
export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
- Configure default storage class
kubectl patch storageclass standard -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
kubectl create -f https://k8s.io/examples/pods/storage/pv-volume.yaml
kubectl get pv task-pv-volume
kubectl create -f https://k8s.io/examples/pods/storage/pv-claim.yaml
kubectl get pvc task-pv-claim
- How to set a pv and pvc
kubectl scale sts web --replicas=2
kubectl delete pvc www-web-2
kubectl patch pv task-pv-volume3 # delete pvc in pv yaml
kubectl get pv # now we have an available pv
- Print the join command
kubeadm token create --print-join-command
- ConfigMap
kubectl create configmap example-redis-config --from-file=redis-config
kubectl get configmap example-redis-config -o yaml
- Redis-Master-Slave-Frontend deploy
thanks
you’re welcome
I’d like to know more things about Kubernetes
I’m not that much of a internet reader to be honest but your blogs really
nice, keep it up! I’ll go ahead and bookmark your website to come back later.
Many thanks http://detective-zakynthinos.net/
Do you mind if I quote a few of your articles as long as I provide credit and sources back to your website?
My blog is in the exact same niche as yours and my visitors would truly benefit from some of the
information you present here. Please let me know if this alright with you.
Cheers! http://detective-zakynthinos.net/
Of course not, it has always been my pleasure to share what I have learned
Ahaa, its good dialogue about this post here at this web site, I have read all that, so now me also commenting here. http://detective-zakynthinos.net/