Kubernetes cluster

If you don’t want to setup the cluster, you can spent some time to explore with exiting online setup.

  • Interactive Tutorial Lets you try out Kubernetes right out of your web browser, using a virtual terminal Kubernetes Interactive Tutorial..
  • Kubernetes Playground Gives you playgroun in web browser Kubernetes Playground.
  • Minikube you can run Kubernetes locally for development and test purpose Minikube.
  • Kind Using kind we can setup one time use cluster
  • Using Virutalbox & vagarnt we can setup the small cluster in our laptop/desktop machine. Other option is get free or trail account from cloud provides.

    Dashboard 2.0 install

    Kubernetes Dashboard 2.0 install 2.0 Dashboard stil in Beta, this notes to install the dashboard to check the new features Install the Beat dashboard. kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml Create the admin user and assing admin role in kubernetes-dashboard name space. cat > admin-user.yaml <<-EOF apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user namespace: kubernetes-dashboard roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard EOF kubectl apply -f admin-user.

    Kubernetes Helm3

    helm repo add stable https://kubernetes-charts.storage.googleapis.com/ helm repo update Install matrics server helm install metrics-server stable/metrics-server -f values.yaml NAME: metrics-server LAST DEPLOYED: Sun Dec 29 09:56:31 2019 NAMESPACE: kubernetes-dashboard STATUS: deployed REVISION: 1 NOTES: The metric server has been deployed. In a few minutes you should be able to list metrics using the following command: kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes"

    Service Account Token

    to get the service account token

    Kubernetes application deployment

    Installing httpbin application httpbin application deployment Installing httpbin application Below yaml will create and deployment. kubectl create -f https://github.com/istio/istio/raw/master/samples/httpbin/httpbin.yaml Ingress Yaml file. apiVersion: extensions/v1beta1 kind: Ingress metadata: name: httpbin-web-server namespace: default spec: rules: - host: httpbin.sfgroups.com http: paths: - path: "/" backend: serviceName: httpbin servicePort: 8000[ Submit the request to httpbin application curl --resolve httpbin.sfgroups.com:30912:192.168.16.211 http://httpbin.sfgroups.com:30912//get?show_env=1 Output { "args": { "show_env": "1" }, "headers": { "Accept": "*/*", "Connection": "close", "Host": "httpbin.

    Kubeadm cluster creation using Linux IPVS and calico CNI

    Production grade cluster creation

    Dashboard 1.0 install

    Dashboard install using HELM and setup external access Install helm wget https://storage.googleapis.com/kubernetes-helm/helm-v2.5.1-linux-amd64.tar.gz tar xvf helm-v2.5.1-linux-amd64.tar.gz cd linux-amd64/ cp -f helm /usr/local/bin chmod +x /usr/local/bin/helm Configure HELM kubectl create serviceaccount --namespace kube-system tiller kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' helm init --service-account tiller --upgrade helm list Install Dashboard & heapster helm install stable/kubernetes-dashboard --name kubernetes-dashboard --namespace kube-system --debug helm install stable/heapster --name heapster -namespace kube-system --debug Install dashboard ingerss contoler curl -k https://raw.

    Kubeadm cluster creation

    Kubernetes project created the kubeadm tools to setup the cluster. As for now this tool in beta status. But kubeadm is good tool to setup the experimental cluster. [Install Kubeadm on your nodes] (https://kubernetes.io/docs/setup/independent/install-kubeadm/) Configure Cluster using kubeadm add the repo install the required rpms. cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOF Remove and install the package yum install epel-release yum makecache fast yum remove -y kubelet kubectl kubernetes-cni kubeadm yum install -y kubelet kubectl kubernetes-cni kubeadm Init the master nodes kubeadm init --pod-network-cidr=10.

    kubectl bash alias

    Below kubectl shortcut will same some time in typing. add these alias in your .bashrc script. alias a='alias' alias k='kubectl ' alias ka='kubectl apply -f ' alias kg='kubectl get ' alias kgn='kubectl get nodes' alias kgnw='kubectl get nodes -o wide' alias kgnl='kubectl get nodes --show-labels' alias kgp='kubectl get pods' alias kgs='kubectl get svc' alias kgd='kubectl get deployments' alias kcf='kubectl create -f ' alias kd='kubectl delete ' alias kdf='kubectl delete -f ' alias kaf='kubectl apply -f ' alias kgpa='kubectl get pods --all-namespaces' Then you can use kgn it will display node status.

    (https://github.com/dennyzhang/cheatsheet-kubernetes-A4)


Copyright © 2004, Software Groups