kubectl is not installed on GCE by default - google-compute-engine

Following the guide I'm trying to manage Google Container Engine cluster from another machine on Google Compute Engine. Here is the output from my GCE instance:
oleksandr_berezianskyi_gmail_com#docker-managed-jenkins:~$ sudo gcloud components update preview
All components are up to date.
oleksandr_berezianskyi_gmail_com#docker-managed-jenkins:~$ sudo gcloud components update alpha
All components are up to date.
oleksandr_berezianskyi_gmail_com#docker-managed-jenkins:~$ gcloud alpha container kubectl create -f cassandra.yaml
ERROR: (gcloud.alpha.container.kubectl) This command requires the kubernetes client (kubectl), which is installed with the gcloud preview component. Run 'gcloud components update preview', or make sure kubectl is installed somewhere on your
path.
As you see my Google Cloud SDK seems to be up-to-date but still not working properly on GCE. Is there something I'm missing?

The correct way to install kubectl is now gcloud components install kubectl
You must have the Google Cloud SDK installed
For further information, Quick Start Guide

If you have run gcloud components update that will install the kubectl binary on your system, it just won't be in your path. It will be located in the cloud-sdk install directory. You can add it to your path manually by running
export PATH=$PATH:/usr/local/share/google/google-cloud-sdk/bin/
or you can create a symlink from a directory that is already in your path, like /usr/local/bin by running
sudo ln -s /usr/local/share/google/google-cloud-sdk/bin/kubectl /usr/local/bin/kubectl

You can download the current version of the kubectl binary from this Google Cloud Storage URL: https://storage.googleapis.com/kubernetes-release/release/v0.18.2/bin/linux/amd64/kubectl

As of (at least) 138.0.0 (Nov 2016)
It's now gcloud components install kubectl
This is when running:
Your current Cloud SDK version is: 138.0.0
Here are the related instructions:
To install or remove components at your current SDK version [138.0.0], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [141.0.0], run:
$ gcloud components update

System Version: macOS 13.1 (22C65)
Chip: Apple M1
ProductVersion: 13.1
export PATH=$PATH:/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/
helped me

Related

Run docker container on OpenShift from Nexus unsecure private registry

I'm trying to run a containerized app which is stored in Nexus docker hosted on url 12.23.34.55:8086
I'm trying to run it on my Openshift Cluster, but I'm getting error. Commands I'm using to run
oc create secret docker-registry mysecret --docker-server=http://12.23.34.55/ --docker-username=aditya --docker-password=aditya --docker-email=aditya#example.org
oc secrets link default mysecret --for=pull
My nexus is running on http://12.23.34.55:8081
Now I'm using command to launch in OpenShift using below command.
oc new-app 12.23.34.55:8085/mytestapp:11 --insecure-registry=true
as per $ oc new-app myregistry:5000/example/myimage
https://docs.openshift.com/container-platform/4.1/applications/application_life_cycle_management/creating-new-applications.html
But it does not work, it asks for password and not able to deploy from console too, can anyone help me with exact commmand.
Creating the secret is not enough for OpenShift to be able to pull from the registry. You still need to link that secret as well.
Take a look at the official documentation here:
https://docs.openshift.com/container-platform/4.1/openshift_images/managing_images/using-image-pull-secrets.html#images-allow-pods-to-reference-images-from-secure-registries_using-image-pull-secrets
Okay! I found an answer, so using private registry first we should import image using
oc import name url/imagename:tag
then we can create new app with the same
oc new app name

The Command Prompt is not recognizing http

I'm trying to install the Google App Engine.
I have Cloud SDK v260.0.0 and Python 2.7.9
When I run the command:
http://code.google.com/appengine/gcloud components install app-engine-python from the cmd
it gives me the error:
'http:' is not recognized as an internal or external command,
operable program or batch file.
What is going on?
I have Windows 10 and I'm running from the Directory:
C:\Users\MyName\AppData\Local\Google\Cloud SDK
Here is the Guide to install app engine for Python 2.
Since you mentioned that Python and Google Cloud SDK have been installed, you might start from step 3 to run the following command in your terminal for the gcloud component:
gcloud components install app-engine-python
As Yanan C stated you install app engine with:
gcloud components install app-engine-python
However, I had to remove the link in the beginning.
Change:
http://code.google.com/appengine/gcloud components install app-engine-python
To:
gcloud components install app-engine-python

Using a connector with Helm-installed Kafka/Confluent

I have installed Kafka on a local Minikube by using the Helm charts https://github.com/confluentinc/cp-helm-charts following these instructions https://docs.confluent.io/current/installation/installing_cp/cp-helm-charts/docs/index.html like so:
helm install -f kafka_config.yaml confluentinc/cp-helm-charts --name kafka-home-delivery --namespace cust360
The kafka_config.yaml is almost identical to the default yaml, with the one exception being that I scaled it down to 1 server/broker instead of 3 (just because I'm trying to conserve resources on my local minikube; hopefully that's not relevant to my problem).
Also running on Minikube is a MySQL instance. Here's the output of kubectl get pods --namespace myNamespace:
I want to connect MySQL and Kafka, using one of the connectors (like Debezium MySQL CDC, for instance). In the instructions, it says:
Install your connector
Use the Confluent Hub client to install this
connector with:
confluent-hub install debezium/debezium-connector-mysql:0.9.2
Sounds good, except 1) I don't know which pod to run this command on, 2) None of the pods seem to have a confluent-hub command available.
Questions:
Does confluent-hub not come installed via those Helm charts?
Do I have to install confluent-hub myself?
If so, which pod do I have to install it on?
Ideally this should be configurable as part of the helm script, but unfortunately it is not as of now. One way to work around this is to build a new Docker from Confluent's Kafka Connect Docker image. Download the connector manually and extract the contents into a folder. Copy the contents of this to a path in the container. Something like below.
Contents of Dockerfile
FROM confluentinc/cp-kafka-connect:5.2.1
COPY <connector-directory> /usr/share/java
/usr/share/java is the default location where Kafka Connect looks for plugins. You could also use different location and provide the new location (plugin.path) during your helm installation.
Build this image and host it somewhere accessible. You will also have to provide/override the image and tag details during the helm installation.
Here is the path to the values.yaml file. You can find the image and plugin.path values here.
Just an add-on to Jegan's comment above: https://stackoverflow.com/a/56049585/6002912
You can choose to do the Dockerfile below. Recommended.
FROM confluentinc/cp-server-connect-operator:5.4.0.0
RUN confluent-hub install --no-prompt debezium/debezium-connector-postgresql:1.0.0
Or you can use a Docker's multi-stage build instead.
FROM confluentinc/cp-server-connect-operator:5.4.0.0
COPY --from=debezium/connect:1.0 \
/kafka/connect/debezium-connector-postgres/ \
/usr/share/confluent-hub-components/debezium-connector-postgres/
This will help you to save time on getting the right jar files for your plugins like debezium-connector-postgres.
From Confluent documentation: https://docs.confluent.io/current/connect/managing/extending.html#create-a-docker-image-containing-c-hub-connectors
The Kafka Connect pod should already have the confluent-hub installed. It is that pod you should run the commands on.
The cp kafka connect pod has 2 containers, one of them is a cp-kafka-connect-server container.That container has confluent-hub installed.You can login into that container and run your connector commands there.To login into that container, run the following command:
kubectl exec -it {pod-name} -c cp-kafka-connect-server -- /bin/bash
As of latest version of chart, this can be achieved using customEnv.CUSTOM_SCRIPT_PATH
See README.md
Script can be passed as a secret and mounted as a volume

Unable to initialize gcloud environment

I have google cloud sdk installed on my ubuntu 14.4system but whenever I type gcloud init in my console, I get the following error:-
rbenv: gcloud: command not found
Further if I run gcloud init with sudo the error changes to:-
/usr/bin/env: ruby1.9.1: No such file or directory
I am unable to understand what has google cloud sdk to do with rbenv. I tried reinstalling google cloud sdk but with the same result. Is there a way out? any help is greatly appreciated.
On linux when you install the SDK it prompts to put following into your ~/.bashrc so PATH and such are setup to make cmds like gcloud visible
# The next line updates PATH for the Google Cloud SDK.
source '/home/scott/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/home/scott/google-cloud-sdk/completion.bash.inc'
If you are not on linux/OSX then the SDK install will have similar
It sounds as though gcloud is not on your $PATH.
If you installed the Cloud SDK to /home/username/google-cloud-sdk/, you should be able to invoke gcloud by running /home/username/google-cloud-sdk/bin/gcloud info. If you would like to be able to run simply gcloud, you can run export PATH="/home/username/google-cloud-sdk/bin:$PATH" (to make this setting persist, put that command in your ~/.profile file.

How do I make gcloud work on opensuse 13.2 in Google Cloud?

I spin up an instance with opensuse 13.2 (x86_64 built on 2015-05-11) in Google Cloud, ssh to the instance, try to run gcloud and get following error:
evgeny#tea-2:~> gcloud
python: can't open file '/usr/bin/../lib/google/cloud/sdk/gcloud/gcloud.py': [Errno 2] No such file or directory
How do I make it work?
Sounds like a bug of some sort. Can try reinstalling it? Try running:
curl https://sdk.cloud.google.com | bash
then log out and log back in
You can pull gcloud directly from Google as shown in Answer #1 or you can use the packaged version from the openSUSE repositories.
After logging in via ssh:
~> sudo -i
# zypper ar -t rpm-md -n 'Cloud Tools Devel' http://download.opensuse.org/repositories/Cloud:/Tools/openSUSE_13.2/ cloud_tools_devel
# zypper install google-cloud-sdk-0.9.44-13.2.noarch
You will need to accept the build key for the new repository that was added.