Skip to main content

Posts

Showing posts from May, 2020

How to enable kubernetes ingress

1.First install ingress on kubernetes cluster 2.Then take which deployment you want to expose outside  Here i was taken apple and banana deployment

How to install apache and Tomcat on both master and worker same time by running ansible play book on master machine

Follow the steps Step-1 1.Take two ubuntu 16.04 machines and enable ssh between them 2.Update host file information on master machine 3.Then do ping test between master and worker machine 4. create apache2.yml playbook --- - hosts: servers  #server host or group name   sudo: yes   tasks:     - name: install apache2       apt: name=apache2 update_cache=yes state=latest     - name: enabled mod_rewrite       apache2_module: name=rewrite state=present       notify:         - restart apache2   handlers:     - name: restart apache2       service: name=apache2 state=restarted Then run ansible play book on master machine then check on both master and worker machine public ip on browser to confirm apache was installed or not . Installing Tomcat After this run play book Then you can check on browser of ...

How to create a user in kubernetes cluster and assign read only permissions

root@ip-172-31-16-42:~# kubectl get secrets NAME                  TYPE                                  DATA   AGE default-token-2m258   kubernetes.io/service-account-token   3      48m root@ip-172-31-16-42:~ # kubectl create serviceaccount readonlyuser serviceaccount/readonlyuser created root@ip-172-31-16-42:~# kubectl create clusterrole readonlyuser --verb=get --verb=list --verb=watch --resource=pods clusterrole.rbac.authorization.k8s.io/readonlyuser created root@ip-172-31-16-42:~ # kubectl create clusterrolebinding readonlyuser --serviceaccount=default:readonlyuser --clusterrole=readonlyuser clusterrolebinding.rbac.authorization.k8s.io/readonlyuser created root@ip-172-31-16-42:~# TOKEN=$(kubectl describe secrets "$(kubectl describe serviceaccount readonlyuser | grep -i Tokens | awk '{print $2}')" | g...