How to upgrade the Kops version - amazon-web-services

I am using Kops to setup my Kubernetes cluster.
This is how, I installed kops,
wget https://github.com/kubernetes/kops/releases/download/1.6.1/kops-linux-amd64
chmod +x kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops
My Kubernetes cluster is pretty old. Now, I want to upgrade it to latest version. I know that kops upgrade cluster works to upgrade the Kubernetes. But, before upgrading the Kubernetes, I want to make sure that my Kops version is latest.
Should I just remove running kops, that is
rm -rf /usr/local/bin/kops
then download the latest release and place it in /usr/local/bin/
wget https://github.com/kubernetes/kops/releases/download/1.11.0/kops-darwin-amd64
chmod +x kops-darwin-amd64
sudo mv kops-darwin-amd64 /usr/local/bin/kops
Is the above procedure correct ? If not, then what is the recommended way to upgrade the Kops ?

Since you're using mac try,
brew upgrade kops

wget
https://github.com/kubernetes/kops/releases/download/1.11.0/kops-darwin-amd64
chmod +x kops-darwin-amd64 sudo mv kops-darwin-amd64
/usr/local/bin/kops
Here is a mistake you use kops-darwin-amd64 but you should use
wget https://github.com/kubernetes/kops/releases/download/1.11.0/kops-linux-amd64
instead.

Related

How do I uninstall current minio and install specific version of Minio with kubectl?

I have installed minio using the following command.
kubectl krew install minio
Right now I have v4.5.6
How do I install v4.2.10 of minio kubernetes ?
Krew doesn't allow to install any particular version according to docs yet.
So to uninstall run
kubectl krew uninstall minio
Then manually install the version you like with the below command.
wget https://github.com/minio/operator/releases/download/**v4.2.10**/kubectl-minio_**4.2.10**_linux_amd64 -O kubectl-minio
chmod +x kubectl-minio
mv kubectl-minio /usr/local/bin/

AWS CLI VERSION UPGRADE

I have installed AWS CLI latest version using "sudo pip install --upgrade awscli " .
this has successfully updated my aws cli version but for only root users, but for all remaining users , it is showing version as previous one only, If I run the command without sudo then its saying permission denied.
If my server has multiple linux users and want to update my aws cli version from 1.16.3 to 1.18.223 for all users, how can I do it ?
Please help me .
Thank in advance
You can adjust the path where you want to install, the binary.
Install the AWS CLI version 1 using the bundled installer with sudo
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.18.223.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Just curious when you are upgrading the AWS Cli why not the latest which is backward compatible and probaly more options
Try not to install pip packages with sudo. Better use a Creating virtual environments

can't start minikube in ec2 shows "X Sorry, Kubernetes v1.18.0 requires conntrack to be installed in root's path"

Hi I am trying to start minikube that's why I ran
minikube start --vm-driver=none
But it shows in the console the below lines:
minikube v1.9.2 on Amazon 2 (Xen/amd64)
Using the none driver based on user configuration
X Sorry, Kubernetes v1.18.0 requires conntrack to be installed in root's path
Note that i have installed kubectl minikube and docker.
Please help me to sort out this issues.
I had the same issue. Install 'conntrack' with
sudo apt install conntrack
Then continue to start your minikube:
sudo minikube start --vm-driver=none
Execute following commands
yum install conntrack
start minikube as root
start --driver=none
TL;DR : update minkikube
You need minkikube not older than v1.9.0-beta
It's a known issue
There is a known issue #7179 reproduced in 1.18
Fixed in Pull Request #7180, the latest commit is 1273d4f:
install conntrack for github action integration tests #7180
Minimal minikube ver that contain commit 1273d4f is v1.9.0-beta:
git clone https://github.com/kubernetes/minikube/
cd minikube
git describe 1273d4f8e756ac5eca89d94c449450fb2da21a5a
>v1.9.0-beta.2-16-g1273d4f8e
Explanation of git describe
Explanation of git describe is here
The command is useful for cases such as:
which tag is closest to the commit? (git describe <sha>)
which tag contains commit? (git describe <sha> --contains)
which branch or annotated tag is closest to the commit? (git describe <sha>--all)
On CentOS 7, run following command:
yum install conntrack
And don't forget to have at least 2 (v)CPUs
You need to install conntrack:
apt-get install conntrack -y
and then you can run the minikube start command again
minikube start --vm-driver=none
make sure you do it as a root user or prefix sudo.
If your running ubuntu, make sure you systemd and kubeadm already installed. I found that this resolved for me
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
at <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Reference Links:
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-
https://minikube.sigs.k8s.io/docs/drivers/none/
I use the following command to resolve the issue:
minikube start --vm-driver=docker

Let's encrypt certbot on AWS Linux

I am new to AWS and Let's encrypt both.
I follow and article and simpley run these commands
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo cp certbot-auto /usr/bin/
Then I run this command.
sudo /usr/bin/certbot-auto --nginx -d example.com -d www.example.com --debug
This gives me the error
Sorry, I don't know how to bootstrap Certbot on your operating system!
You will need to install OS dependencies, configure virtualenv, and
run pip install manually. Please see
https://letsencrypt.readthedocs.org/en/latest/contributing.html#prerequisites
for more info.
What does this really means?
How do I setup certbot on AWS linux?
I have created a fresh amazon linux 2 ec2 instance and tested the following for you.
The following steps are working for me.
Edit the file /usr/bin/certbot-auto to recognize your version of Linux:
$ sudo vim /usr/bin/certbot-auto
find this line in the file (likely near line nearr 780):
elif [ -f /etc/redhat-release ]; then
and replace whole line with this:
elif [ -f /etc/redhat-release ] || grep 'cpe:.*:amazon_linux:2' /etc/os-release > /dev/null 2>&1; then
Save and exit vim (type :wq to do that)
Reference:
Deploying Let’s Encrypt on an Amazon Linux AMI EC2 Instance
Make sure that system requirements are met, you can find the system requirement here.
Also here are the best practices for certbot-auto deploment.
Navigate to your home directory (/home/ec2-user).
Download EPEL using the following command. sudo wget -r --no-parent -A 'epel-release-*.rpm' https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
Install the repository packages as shown in the following command.
sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
Enable EPEL as shown in the following command. sudo yum-config-manager --enable epel*
Confirm that EPEL is enabled with the following command.
sudo yum repolist all
Install and run Certbot
This procedure is based on the EFF documentation for installing Certbot on Fedora and on RHEL 7. It describes the default use of Certbot, resulting in a certificate based on a 2048-bit RSA key.
sudo yum install -y certbot python2-certbot-apache or sudo yum install -y certbot python2-certbot-nginx For nginx.
Source here

How to uninstall aws-cli

I am trying to set up an "Amazon Elastic Container Registry" but I get the following error when using this command: aws ecr get-login --no-include-email --region us-west-2:
Unknown options: --no-include-email
The manual redirects me when this occurs to go to the following page, in order to update my aws cli. https://docs.aws.amazon.com/cli/latest/userguide/installing.html
Which in short means, call pip install awscli --upgrade --user. While that works, my cli is not updated. So I removed it at all pip uninstall awscli. But I still had the aws command available, also when I opened a new session in the terminal...
So I assume I haven't installed my aws cli via pip, but I can not figure out how it does is installed. Can anyone help me out and give me some directions to resolve this issue. So I can remove the current awscli, and install a new version via pip install awscli --upgrade --user
I had a similar issue. Answering in case someone else does too. I think I had originally installed it without pip like this:
https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html.
So you just need to uninstall it like this (as instructed in above link):
$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws
Then you can re-install it with pip3:
https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html
Basically:
pip3 install awscli --upgrade --user
Then add it to your path
export PATH=/Users/yourname/Library/Python/3.6/bin/:$PATH
On ubuntu :
sudo apt-get remove --auto-remove awscli
ln -s /home/ubuntu/.local/bin/aws /usr/bin/aws
Uninstall awscli.
pip uninstall awscli -y
I had the same issue, but unlike Morgan, I prefer to use Homebrew to maintain all my dependencies in a single place.
So what I did was:
1 - uninstall awscli (was installed with pip - python2)
$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws
2 - Install awscli using homebrew
$ brew install awscli
Homebrew will install awscli inside Cellar folder: /usr/local/Cellar/awscli
Note: I also have python3 installed through Hombrew.
Links:
Amazon-awscli: Amazon Install awscli
Homebrew-awscli: Homebrew Install awscli
Homebrew-python3: Homebrew Install python3
If you are using mac and used brew to install aws cli. Use brew uninstall awscli and try brew install awscli
First try to get the path of the installation by using this command in Linux or mac
which aws-cli
After you get the installation location try removing the directory by using
sudo rm -rf "/path resultant from previous command"
In case if someone has installed aws-cli using Snap,then following method might be helpful :
First, open the Linux terminal and run the following command in it:
sudo snap remove aws-cli
The basic command line to remove a snap package is
sudo snap remove < package >
You have to put the name of a specific application instead of < package >
Once you execute the command successfully, the terminal will ask you to enter the [sudo] password you put for the installation, but if you don’t have any password, press Enter to process it.
After completion of this procedure, you will see that aws-cli gets uninstalled from the system. However, the folder of aws is still present in the snap folder, so execute the following command to remove it:
sudo snap rm -r aws-cli
Remove respective bin & config files:
rm -rf /usr/local/bin/saml2aws
rm -rf ~/.aws/config
rm -rf ~/.aws/credentials
Reinstall using the 'install.sh' script
I tried this on linux and it seemed to work
sudo yum erase awscli
and get me to a place where when I run:
aws --version
zsh: command not found: aws