First we have to launch ubuntu 18.04 & login through putty
then enter root
--------------------------------------------------------------------------------------------------
Configure awscli by these commands
--------------------------------------------------------------------------------------------------
1 curl https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip
2 apt install unzip python
3 ls
4 unzip awscli-bundle.zip
5 ls -l
6 ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
7 aws
-------------------------------------------------------------------------------------------------
After this install kubernetes
-------------------------------------------------------------------------------------------------
12 curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s
https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
13 chmod +x ./kubectl
14 sudo mv ./kubectl /usr/local/bin/kubectl
-----------------------------------------------------------------------------------------------------------------
Create 1 s3 bucket & iam role & give s3full & ec2full & route53 & iam full Acesss to the role
-----------------------------------------------------------------------------------------------------------------
15 aws s3 ls
16 aws configure
17 aws s3 mb s3://devdas.k8s.valaxy.in === s3 bucket name should be unique
22 aws s3 ls
23 export KOPS_STATE_STORE=s3://dev.k8s.valaxy.in
24 ssh-keygen
======================================================================== These are the commands by which i got errors
========================================================================
25 kops create cluster --cloud=aws --zones=us-east-1a --name=prati.k8s.valaxy.in --dns-
zone=valaxy.in --dns private
26 kops create cluster --cloud=aws --zones=us-east-1a --name=prati11.k8s1.valaxy1.in --dns-
zone=valaxy.in --dns private
27 kops create cluster --cloud=aws --zones=us-east-1b --name=prati11.k8s1.valaxy1.in --dns-
zone=valaxy.in --dns private
28 aws s3 mb s3://dev1.k8s.valaxy.in
29 aws s3 mb s3://pratyusha
30 kops create cluster --cloud=aws --zones=us-east-1b --name=prathyusha --dns-zone=valaxy.in --dns private
31 kops create cluster --cloud=aws --zones=us-east-1b --name=pratyusha --dns-zone=valaxy.in --dns private
32 aws s3 mb s3://devdas.k8s.valaxy.in
33 kops create cluster --cloud=aws --zones=us-east-1b --name= devdas.k8s.valaxy.in --dns-zone=valaxy.in --dns private
34 export AWS_DEFAULT_PROFILE=<your_aws_credentials_profile_name>
35 export AWS_DEFAULT_PROFILE=<naredrareddym2002>
36 export AWS_DEFAULT_PROFILE=naredrareddym2002
37 export AWS_SDK_LOAD_CONFIG=1
38 kops create cluster --cloud=aws --zones=us-east-1b --name=devdas.k8s.valaxy.in --dns-zone=valaxy.in --dns private
39 kops create cluster --name=SOME_CLUSTER_NAME --state=s3://SOME_BUCKET --node-count=3 --authorization=RBAC --zones=us-west-2a,us-west-2b,us-west-2c --master-zones=us-west-2a,us-west-2b,us-west-2c --node-size=m5.large --master-size=r4.large --master-count=3 --networking=weave --topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 --target=terraform -v 100
40 kops create cluster --name=SOME_CLUSTER_NAM --state=s3://devdas.k8s.valaxy.in --node-count=3 --authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a,us-west-2b,us-west-2c --node-size=m5.large --master-size=r4.large --master-count=3 --networking=weave --topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 --target=terraform -v 100
41 kops create cluster --name=privateclus --state=s3://devdas.k8s.valaxy.in --node-count=2 --authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a --node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave --topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 --target=terraform -v 100
42 cat ~/.aws/config
43 kops create cluster --name=privateclus.valaxy.in --state=s3://devdas.k8s.valaxy.in --node-
count=2 --authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-
east-1a --node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave --
topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0
target=terraform -v 100
44 kops create cluster --name=valaxy.in --state=s3://devdas.k8s.valaxy.in --node-count=2 --
authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a --
node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave
topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 -- target=terraform -v 100
45 top
46 kops update cluster devdas.k8s.valaxy.in --yes
47 export KOPS_STATE_STORE
48 kops create cluster --name=valaxy.in --state=s3://devdas.k8s.valaxy.in --node-count=2 --
authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a -- node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave --
topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 -- target=terraform -v 100
49 kops create cluster --cloud=aws --zones=us-east-1c --name=devdas.k8s.valaxy.in --dns- zone=valaxy.in --dns private
50 kops create cluster --cloud=aws --zones=us-east-1c --name=devdas.k8s.valaxy.in --dns-
zone=valaxy.in --dns private export KOPS_STATE_STORE
========================================================================
Remove errors in this command, we have given --state flag in which s3 bucket all the files should enter
-------------------------------------------------------------------------------------------------------------------------
51 kops create cluster --cloud=aws --zones=us-east-1c --name=devdas.k8s.valaxy.in
--state=s3://devdas.k8s.valaxy.in --dns-zone=valaxy.in --dns private
--------------------------------------------------------------------------------------------------
55 export KOPS_STATE_STORE=s3://devdas.k8s.valaxy.in
56 ls
--------------------------------------------------------------------------------------------------
To get details of the kubernetes cluster
--------------------------------------------------------------------------------------------------
57 kops update cluster devdas.k8s.valaxy.in
--------------------------------------------------------------------------------------------------
To create a cluster
--------------------------------------------------------------------------------------------------
58 kops update cluster devdas.k8s.valaxy.in --yes
59 kops validate cluster
--------------------------------------------------------------------------------------------------
To get node details
--------------------------------------------------------------------------------------------------
60 kubectl get nodes
--------------------------------------------------------------------------------------------------
To get configuaration details
--------------------------------------------------------------------------------------------------
66 vi ~/.kube/config
--------------------------------------------------------------------------------------------------
To enter into the master (ssh -i .ssh/id_rsa admin@ipv4-public-ip-of-master)
--------------------------------------------------------------------------------------------------
69 ssh -i .ssh/id_rsa admin@3.82.160.192
70 cd .ssh
71 ls
72 ssh -i id_rsa admin@3.82.160.192
--------------------------------------------------------------------------------------------------
After entering into master we check nodes status
--------------------------------------------------------------------------------------------------
admin@ip-172-20-53-221:~$
2 kubectl get nodes
5 kubectl get pods
6 kubectl --help
7 ls -la
8 cd .ssh
9 ls
10 cd ..
11 sudo -i
12 exit
13 kubectl get nodes
--------------------------------------------------------------------------------------------------
We need to create pods in the nodes:
POD - write a code to deploy like web servers -tomcat /nginx
--------------------------------------------------------------------------------------------------
14 kubectl run sample-nginx --image=nginx --replicas=2 --port=80
15 kubectl get pods
16 kubectl get deployments
17 kubectl expose deployment sample-nginx --port=80 --type=LoadBalancer
18 ls
19 kubectl get services -o wide
20 kubectl get services
21 kubectl get pods
22 kubectl describe pod sample-nginx-594488f9c5-gvlqx
admin@ip-172-20-53-221:~$ exit
logout
Connection to 3.82.160.192 closed.
then enter root
--------------------------------------------------------------------------------------------------
Configure awscli by these commands
--------------------------------------------------------------------------------------------------
1 curl https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip
2 apt install unzip python
3 ls
4 unzip awscli-bundle.zip
5 ls -l
6 ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
7 aws
-------------------------------------------------------------------------------------------------
After this install kubernetes
-------------------------------------------------------------------------------------------------
12 curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s
https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
13 chmod +x ./kubectl
14 sudo mv ./kubectl /usr/local/bin/kubectl
-----------------------------------------------------------------------------------------------------------------
Create 1 s3 bucket & iam role & give s3full & ec2full & route53 & iam full Acesss to the role
-----------------------------------------------------------------------------------------------------------------
15 aws s3 ls
16 aws configure
17 aws s3 mb s3://devdas.k8s.valaxy.in === s3 bucket name should be unique
22 aws s3 ls
23 export KOPS_STATE_STORE=s3://dev.k8s.valaxy.in
24 ssh-keygen
======================================================================== These are the commands by which i got errors
========================================================================
25 kops create cluster --cloud=aws --zones=us-east-1a --name=prati.k8s.valaxy.in --dns-
zone=valaxy.in --dns private
26 kops create cluster --cloud=aws --zones=us-east-1a --name=prati11.k8s1.valaxy1.in --dns-
zone=valaxy.in --dns private
27 kops create cluster --cloud=aws --zones=us-east-1b --name=prati11.k8s1.valaxy1.in --dns-
zone=valaxy.in --dns private
28 aws s3 mb s3://dev1.k8s.valaxy.in
29 aws s3 mb s3://pratyusha
30 kops create cluster --cloud=aws --zones=us-east-1b --name=prathyusha --dns-zone=valaxy.in --dns private
31 kops create cluster --cloud=aws --zones=us-east-1b --name=pratyusha --dns-zone=valaxy.in --dns private
32 aws s3 mb s3://devdas.k8s.valaxy.in
33 kops create cluster --cloud=aws --zones=us-east-1b --name= devdas.k8s.valaxy.in --dns-zone=valaxy.in --dns private
34 export AWS_DEFAULT_PROFILE=<your_aws_credentials_profile_name>
35 export AWS_DEFAULT_PROFILE=<naredrareddym2002>
36 export AWS_DEFAULT_PROFILE=naredrareddym2002
37 export AWS_SDK_LOAD_CONFIG=1
38 kops create cluster --cloud=aws --zones=us-east-1b --name=devdas.k8s.valaxy.in --dns-zone=valaxy.in --dns private
39 kops create cluster --name=SOME_CLUSTER_NAME --state=s3://SOME_BUCKET --node-count=3 --authorization=RBAC --zones=us-west-2a,us-west-2b,us-west-2c --master-zones=us-west-2a,us-west-2b,us-west-2c --node-size=m5.large --master-size=r4.large --master-count=3 --networking=weave --topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 --target=terraform -v 100
40 kops create cluster --name=SOME_CLUSTER_NAM --state=s3://devdas.k8s.valaxy.in --node-count=3 --authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a,us-west-2b,us-west-2c --node-size=m5.large --master-size=r4.large --master-count=3 --networking=weave --topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 --target=terraform -v 100
41 kops create cluster --name=privateclus --state=s3://devdas.k8s.valaxy.in --node-count=2 --authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a --node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave --topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 --target=terraform -v 100
42 cat ~/.aws/config
43 kops create cluster --name=privateclus.valaxy.in --state=s3://devdas.k8s.valaxy.in --node-
count=2 --authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-
east-1a --node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave --
topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0
target=terraform -v 100
44 kops create cluster --name=valaxy.in --state=s3://devdas.k8s.valaxy.in --node-count=2 --
authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a --
node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave
topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 -- target=terraform -v 100
45 top
46 kops update cluster devdas.k8s.valaxy.in --yes
47 export KOPS_STATE_STORE
48 kops create cluster --name=valaxy.in --state=s3://devdas.k8s.valaxy.in --node-count=2 --
authorization=RBAC --zones=us-east-1a,us-east-1b,us-east-1c --master-zones=us-east-1a -- node-size=t2.micro --master-size=r4.large --master-count=3 --networking=weave --
topology=private --ssh-public-key=/root/.ssh/id_rsa.pub --kubernetes-version=1.10.0 -- target=terraform -v 100
49 kops create cluster --cloud=aws --zones=us-east-1c --name=devdas.k8s.valaxy.in --dns- zone=valaxy.in --dns private
50 kops create cluster --cloud=aws --zones=us-east-1c --name=devdas.k8s.valaxy.in --dns-
zone=valaxy.in --dns private export KOPS_STATE_STORE
========================================================================
Remove errors in this command, we have given --state flag in which s3 bucket all the files should enter
-------------------------------------------------------------------------------------------------------------------------
51 kops create cluster --cloud=aws --zones=us-east-1c --name=devdas.k8s.valaxy.in
--state=s3://devdas.k8s.valaxy.in --dns-zone=valaxy.in --dns private
--------------------------------------------------------------------------------------------------
55 export KOPS_STATE_STORE=s3://devdas.k8s.valaxy.in
56 ls
--------------------------------------------------------------------------------------------------
To get details of the kubernetes cluster
--------------------------------------------------------------------------------------------------
57 kops update cluster devdas.k8s.valaxy.in
--------------------------------------------------------------------------------------------------
To create a cluster
--------------------------------------------------------------------------------------------------
58 kops update cluster devdas.k8s.valaxy.in --yes
59 kops validate cluster
--------------------------------------------------------------------------------------------------
To get node details
--------------------------------------------------------------------------------------------------
60 kubectl get nodes
--------------------------------------------------------------------------------------------------
To get configuaration details
--------------------------------------------------------------------------------------------------
66 vi ~/.kube/config
--------------------------------------------------------------------------------------------------
To enter into the master (ssh -i .ssh/id_rsa admin@ipv4-public-ip-of-master)
--------------------------------------------------------------------------------------------------
69 ssh -i .ssh/id_rsa admin@3.82.160.192
70 cd .ssh
71 ls
72 ssh -i id_rsa admin@3.82.160.192
--------------------------------------------------------------------------------------------------
After entering into master we check nodes status
--------------------------------------------------------------------------------------------------
admin@ip-172-20-53-221:~$
2 kubectl get nodes
5 kubectl get pods
6 kubectl --help
7 ls -la
8 cd .ssh
9 ls
10 cd ..
11 sudo -i
12 exit
13 kubectl get nodes
--------------------------------------------------------------------------------------------------
We need to create pods in the nodes:
POD - write a code to deploy like web servers -tomcat /nginx
--------------------------------------------------------------------------------------------------
14 kubectl run sample-nginx --image=nginx --replicas=2 --port=80
15 kubectl get pods
16 kubectl get deployments
17 kubectl expose deployment sample-nginx --port=80 --type=LoadBalancer
18 ls
19 kubectl get services -o wide
20 kubectl get services
21 kubectl get pods
22 kubectl describe pod sample-nginx-594488f9c5-gvlqx
admin@ip-172-20-53-221:~$ exit
logout
Connection to 3.82.160.192 closed.
No comments:
Post a Comment